Showing user ID on user main page from screen options

On the user main page in the screen options, you have some choices for displaying user information e.g.. e-mail, role, posts etc..

Is there a way to be able to display the user’s unique ID?

Related posts

1 comment

  1. You need to use the filter 'manage_' . $screen->id . '_columns' to add a column and manage_users_custom_column to display its value.

    add_filter( 'manage_users_columns', 'column_register_wpse_101322' );
    add_filter( 'manage_users_custom_column', 'column_display_wpse_101322', 10, 3 );
    
    function column_register_wpse_101322( $columns ) 
    {
        $columns['uid'] = 'ID';
        return $columns;
    }
    
    function column_display_wpse_101322( $empty, $column_name, $user_id ) 
    {
        if ( 'uid' != $column_name )
            return $empty;
    
        return "<strong>$user_id</strong>";
    }
    

    With this, the ID will show up in the Screen Options as well.

Comments are closed.