SO网友:B. Shea
这是一个老问题,但现在有了。。但形式结束(仅限)。
WP版本4.3.0-文件“/WP admin/user new.php”-第330行
/**
* Fires at the end of the new user form.
*
* Passes a contextual string to make both types of new user forms
* uniquely targetable. Contexts are \'add-existing-user\' (Multisite),
* and \'add-new-user\' (single site and network admin).
*
* @since 3.7.0
*
* @param string $type A contextual string specifying which type of new user form the hook follows.
*/
do_action( \'user_new_form\', \'add-existing-user\' );
简短示例:
add_action(\'user_new_form\', \'addmycustomfield\');
function addmycustomfield() {
?>
<table class="form-table">
<tr>
<th scope="row">My test field:</th>
<td><input type="text" size="32" name="testfield" value="<?php echo get_option(\'madeup_wp_option\'); ?>" /></td>
</tr>
</table>
<?php
}
这将在添加用户表单的末尾放置一个字段。如何从注册/添加用户/配置文件编辑/etc保存自定义用户元数据/etc超出了问题的范围,之前已经回答过多次。请参见注释。