Title: Hide Admin from user list
Last modified: August 21, 2016

---

# Hide Admin from user list

 *  [mucheroni](https://wordpress.org/support/users/mucheroni/)
 * (@mucheroni)
 * [12 years ago](https://wordpress.org/support/topic/hide-admin-from-user-list-1/)
 * I having this annoying problem, need to hide the Administrator for the other 
   users at the user list…like in the image:
    [https://drive.google.com/file/d/0Bzqs439iIKtxSGlWLXNTbVp2Wmc/edit?usp=sharing](https://drive.google.com/file/d/0Bzqs439iIKtxSGlWLXNTbVp2Wmc/edit?usp=sharing)
 * so..i need the shop manager just see hes own account or the other clientes future
   accounts, but not the administrator account.
 * I tried all things saw online but nothing works, like:
 * add_action(‘pre_user_search’,’yoursite_pre_user_search’);
    function yoursite_pre_user_search(
   $user_search) { $user = wp_get_current_user(); if ($user->ID!=1) { // Is not 
   administrator, remove administrator global $wpdb; $user_search->query_where =
   str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID<>1”,$user_search->query_where);}}
 * please im pretty newby,someone can help me?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [mucheroni](https://wordpress.org/support/users/mucheroni/)
 * (@mucheroni)
 * [12 years ago](https://wordpress.org/support/topic/hide-admin-from-user-list-1/#post-4945236)
 * version is 3.9.1
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years ago](https://wordpress.org/support/topic/hide-admin-from-user-list-1/#post-4945329)
 * You’re actually very close, it’s just a matter of sorting out the syntax errors.
   For that, I’m not of much help, mySQL is not something I am strong at. Here is
   my guess at the correct syntax:
    `$user_search->query_where = str_replace('WHERE
   1=1', "$wpdb->users.ID!=1",$user_search->query_where);`
 * This assumes the one and only administrator’s ID is 1, which may be true for 
   many sites, but you should confirm your site’s specifics. A more robust approach
   would be to query for all users with admin roles, then implode the resulting 
   IDs into a comma delimited list, say into `$admin_ids`, then the WHERE query 
   becomes this;
    `$user_search->query_where = str_replace('WHERE 1=1', "$wpdb->
   users.ID NOT IN ($admin_ids)",$user_search->query_where);`

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hide Admin from user list’ is closed to new replies.

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [list](https://wordpress.org/support/topic-tag/list/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/hide-admin-from-user-list-1/#post-4945329)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
