[Solved] How can I hide username in the dashboard area of WordPress?

  

3
Topic starter

How can I hide a particular username (or maybe even admin account) in the WordPress dashboard area;

Here is the screenshot of what I mean:

how to hide username in the admin area of wordpress cms

I DO NOT want the first username to be visible.

Maybe with some code in the functions.php and some CSS?

1 Answer
2

Here is the code in 2 parts:

1st part - function with PHP and CSS - to hide the username in the dashboard area with the admin_head hook:

/* Hide username in WordPress dashboard area*/
function hideAdmin() {
    echo '<style>
    .wp-list-table tr[id="user-2"]{ display:none; }
    </style>';
}
 
add_action('admin_head', 'hideAdmin');

2nd part - function with PHP and CSS - to hide the number of administrators above:

/*Hide the count of the administrator in the WordPress dashboard area*/
function hide_user_count() {
    echo '<style>
        .wp-admin.users-php span.count {
            display: none;
        }
    </style>';
}
 
add_action('admin_head', 'hide_user_count');

Here is a post from where I took part of the code: https://trickspanda.com/hide-specific-admin-user-list-wordpress/

Share: