【发布时间】:2020-12-07 11:26:34
【问题描述】:
我想知道如何实现以下目标。 我尝试在联系信息下的 wordpress 用户配置文件中创建一个数字字段输入。
到目前为止,如果我使用 show_user_profile 和 edit_user_profile 挂钩,该字段将出现在个人资料页面的底部。
是否可以在联系信息部分下创建一个数字字段(wordpress中的标准?)
我尝试为操作添加不同的优先级,但这并没有解决问题。
到目前为止,我有以下内容:
function addurenuser(){
$userid = get_current_user_id();
if ( current_user_can('update_plugins',$userid)){ ?>
<table class="form-table">
<tr>
<th>
<label>Uren</label>
</th>
<td>
<input type="number" name="uren" id="uren" value="<?php echo esc_attr( get_the_author_meta( 'uren', $user->ID ) ); ?>">
</td>
</tr>
</table> <?php
}
}
add_action( 'show_user_profile', 'addurenuser' );
add_action( 'edit_user_profile', 'addurenuser' );
【问题讨论】: