WordPress   

Hide any user from the list of users in WordPress Dashboard

Replace yourusername with the username you want to hide.

add_action('pre_user_query','hide_user_from_list');
function hide_user_from_list($user_search) {
  global $current_user;
  $username = $current_user->user_login;
    global $wpdb;
    $user_search->query_where = str_replace('WHERE 1=1',
      "WHERE 1=1 AND {$wpdb->users}.user_login != 'yourusername'",$user_search->query_where);

}
Need Professional Support for Your Website Problems?

Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.

Hire Us