Php 仪表板中wordpress用户管理的额外字段
我需要在wordpressPhp 仪表板中wordpress用户管理的额外字段,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我需要在wordpress管理仪表板中的添加新用户和编辑用户页面中添加额外字段 我可以使用hookEdit\u user\u profile将其添加到Edit user。但是如何在addnewuser页面中添加它呢 此外,我还想向user wp list表添加一些额外的列 add_action( 'edit_user_profile', 'my_show_extra_profile_fields' ); function my_show_extra_profile_fields( $user
管理仪表板中的添加新用户
和编辑用户
页面中添加额外字段
我可以使用hookEdit\u user\u profile
将其添加到Edit user
。但是如何在addnewuser
页面中添加它呢
此外,我还想向user wp list表添加一些额外的列
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) {
}
如果您查阅核心代码,在/wp admin/user new.php
中可以找到两个钩子:
user\u new\u form\u标签
–位于现有表单字段之前
user\u new\u表单
–在现有表单字段之后
如果您选中/wp admin/user new.php
,您将看到两个Dou操作,尽管我从未尝试过使用这些挂钩
钩子在窗体上添加标记或属性
<form method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"<?php
/**
* Fires inside the adduser form tag.
*
* @since 3.0.0
*/
do_action( 'user_new_form_tag' );
?>>
及
您可能还想检查钩子
/**
* 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' );
<?php
/** This action is documented in wp-admin/user-new.php */
do_action( 'user_new_form', 'add-new-user' );
?>