admin管理员组

文章数量:1296330

I'm getting the following error message when I try to update my user account settings: Your Nickname must be different than your login name. Please choose a different Nickname. But there's no Nickname field, so I'm not sure what's happening. I remember that there used to be a Nickname field on other sites I've developed

I'm getting the following error message when I try to update my user account settings: Your Nickname must be different than your login name. Please choose a different Nickname. But there's no Nickname field, so I'm not sure what's happening. I remember that there used to be a Nickname field on other sites I've developed

Share Improve this question asked Apr 5, 2021 at 17:13 Laura SageLaura Sage 2255 silver badges11 bronze badges 1
  • the error might be related to a plugin? possibly core.trac.wordpress/ticket/29873#comment:1 are you logged in as a – Michael Commented Apr 5, 2021 at 18:30
Add a comment  | 

1 Answer 1

Reset to default 1

When you display All Users, it will display values from users table. You will not see Nickname column, because Nickname value is in usermeta table. Put the following code to your child theme's functions.php file. First filter manage_users_columns will add custom column Nickname to All Users view. Second filter manage_users_custom_column will retrieve values from usermeta table for Nickname column.

function wpse_add_to_user_table($column) {
    $column['nickname'] = 'Nickname';
    return $column;
}
add_filter('manage_users_columns', 'wpse_add_to_user_table');

function wpse_disply_in_user_table_row($value, $column_name, $user_id) {
    switch ($column_name) {
        case 'nickname' :
            return get_user_meta($user_id, 'nickname', true);
        default:
    }
    return $value;
}
add_filter('manage_users_custom_column', 'wpse_disply_in_user_table_row', 10, 3);

Please note that Nickname field is always present when you Edit user.

本文标签: usersNickname field isn39t appearing in Admin