Some readers have asked us how to disable the WordPress admin bar. While it’s a small tweak, some users prefer to do this for various reasons, such as maintaining a cleaner user interface or enhancing the user experience for non-admin users.
By default, you can easily disable the WordPress admin bar for individual users. However, this can be time-consuming if you have a large number of registered users on your site.
In this article, we will show you how to easily disable the WordPress admin bar for all users except administrators.
What Is the WordPress Admin Bar?
By default, WordPress shows an admin bar at the top of the screen for all logged-in users. When you are logged into your account, you can see this toolbar in the WordPress admin area and all other pages.
The WordPress admin toolbar has useful shortcuts to different backend areas of WordPress, and these shortcuts change based on a user’s role and permissions in WordPress.
However, the admin bar can be distracting when you are looking at the front end of your website.
It may also affect your website’s design and user experience. This can be a problem if you are building or managing a WordPress site for a third party, as it stops them from seeing what their website really looks like.
Luckily, there are multiple ways to disable the admin bar for all users except administrators. Simply use the quick links below to jump to the method you want to use:
Video Tutorial
If you prefer written instructions, then just keep reading.
Method 1: Change Each User’s Permissions in WordPress
You can disable the admin bar for specific users by simply editing their user profile. This is a quick and easy method if you just need to remove the bar for a small number of people. However, if you run a membership site with a lot of users, then we recommend choosing a different method.
To remove the admin bar manually, simply go to the Users » All Users page in the WordPress admin dashboard. Then hover your mouse over the WordPress user who doesn’t need the admin bar, and click on ‘Edit’ when it appears.
This will bring open that user’s profile.
From here, uncheck the box next to the ‘Show toolbar when viewing site’ option.
After that, scroll to the bottom of the screen and click on ‘Update User’ to save your changes. This will disable the admin bar for that specific person only.
To hide the toolbar for more users, simply follow the same process described above.
Method 2: Use Code to Disable Admin Bar for Non-Admin Users (Recommended)
If you need to hide the admin bar for lots of different people, then changing each user’s settings manually would take a lot of time and effort.
For that reason, we recommend disabling the admin bar by adding code to the functions.php file, which is a WordPress theme file.
Some guides will tell you to edit the theme files manually, but this can cause common WordPress errors and may even completely break your website.
For that reason, we recommend using WPCode. It is the best code snippet plugin and makes it easy to add custom code in WordPress without putting your site at risk.
We’ve used WPCode to change the admin color scheme, remove the ‘Howdy Admin’ text, disable the Screen Options button, and more.
First, you will need to install and activate the free WPCode plugin. For more information, see our step-by-step guide on how to install a WordPress plugin.
Once the plugin is activated, go to Code Snippets » Add Snippet.
Here, you will see all the pre-made snippets you can add to your site.
In fact, WPCode has the exact code snippet you need to disable the admin bar in its built-in Snippet Library. Simply go to Code Snippets » Library.
Here, search for ‘Disable The WP Admin Bar’.
When the right snippet shows up, just click on its ‘Use Snippet’ button.
The plugin will automatically add the code to your site, give the code a descriptive title, choose the correct insertion method, and even add tags to help you identify the snippet.
Here’s what the code looks like:
/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );
Now, if your goal is to disable the admin bar for all users, then all you need to do is toggle the switch from ‘Inactive’ to ‘Active’ and then click on ‘Update’.
However, since our goal is to disable the WordPress admin bar for non-admin users, then we need to make some small tweaks to the code.
You can replace the existing code with the following:
/* Disable WordPress Admin Bar for all users except administrators */
add_filter( 'show_admin_bar', 'restrict_admin_bar' );
function restrict_admin_bar( $show ) {
return current_user_can( 'administrator' ) ? true : false;
}
This code identifies any non-admin users who are not currently looking at the admin dashboard. For these users, it disables the WordPress admin bar.
After that, scroll down the page to the ‘Insertion’ section. Here, you can keep the default’ Auto Insert’ method to make sure the code runs everywhere.
Finally, scroll to the top of the screen and click on the ‘Inactive’ slider so that it shows ‘Active.’
Then, just click the ‘Save Snippet’ or ‘Update’ button to make the code snippet live.
That’s it! Just remember to check your WordPress website to make sure everything is working fine.
Method 3: Use a Free Plugin to Disable Admin Bar for Non-Admin Users
If you don’t want to add code to your website, then you can hide the admin bar using a plugin. Hide Admin Bar Based on User Roles lets you remove the toolbar based on different user roles, so this is a good choice if you want to disable the bar for all members, WooCommerce customers, or some other user role.
First, you need to install and activate the Hide Admin Bar Based on User Roles plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you need to go to the Settings » Hide Admin Bar Settings page. From here, check the boxes next to the user roles where you want to disable the admin bar.
With that done, simply click on ‘Save Changes’ to store your settings.
We hope this article helped you learn how to disable the WordPress admin bar for all users except administrators. You may also want to see our guide on how to get email notifications for post changes in WordPress and our expert picks of the best WordPress activity log and tracking plugins.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Jiří Vaněk
This is really very useful for a website with multiple authors. I applied it almost immediately after reading about it. I hadn’t paid much attention to this issue before, but since I recently completed a website with multiple authors, this tutorial was very timely, and once again, you led me to an interesting modification that improves security.
Livingstone
Causing an error when activated
WPBeginner Support
It would depend on what method you are using as well as the error for us to be able to assist. If you reach out using our contact form our support team should be able to assist you further
Admin
Dayo Olobayo
Thank you for the article but please is there a way to style the admin bar to my choice?
WPBeginner Support
For that we would recommend taking a look at our article below!
https://www.wpbeginner.com/beginners-guide/how-to-customize-wordpress-admin-area-dashboard-for-beginners/#customizeadmintoolbar
Admin
Hajjalah
I have a Question and Answer plugin on my blog which automatically adds admin bar for all users whenever i make an update on it. I am glad that WPCode has completely disabled this annoying feature. Thanks WPBeginner for the helpful article.
WPBeginner Support
You’re welcome!
Admin
Moinuddin Waheed
This is very needed to hide the admin bar to all the user’s except the administrator.
I have thought of doing this multiple times over specially when I was running news website and I had many authors and contributors.
Showing them admin bar is not only unnecessary but annoying too.
Really appreciate for the steps to get rid of this admin bar and keep it for only the administrator.
Amos Showole
Wow… This is great, you solved an issue I faced with on one of my WordPress website that BuddyPress was installed on….
WPBeginner Support
Happy to hear our guide was helpful!
Admin