2015-11-22 83 views
0

我需要在wordpress admin dashboardAdd new userEdit user頁面中添加額外字段。儀表板中wordpress用戶管理的額外字段

我可以使用鉤子edit_user_profile將此添加到Edit user。但如何將其添加到Add new user頁面?

另外我想添加一些額外的列到用戶wp列表中。

add_action('edit_user_profile', 'my_show_extra_profile_fields'); 

function my_show_extra_profile_fields($user) { 

} 

回答

0

如果您諮詢的核心代碼,在/wp-admin/user-new.php你可以找到兩個掛鉤:

  • user_new_form_tag –現有的表單字段前
  • user_new_form –現有的表單字段後
0

如果你檢查/wp-admin/user-new.php你會看到兩個do_action,你GH我在使用這些掛鉤

鉤添加標籤或表格屬性

<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'); 
?> 

您還可能要檢查從來沒有嘗試過user_register掛鉤

相關問題