Are you looking for a simple method to disable the WordPress Admin Bar for All Users except Admins? If yes, luckily you have just come to the right place. Our article will share with you three useful solutions to tackle this problem effectively.
What is WordPress Admin Dashboard?
WordPress Admin Dashboard is a floating toolbar showcased at the top of the screen. From here, all logged-in users can have quick access to various admin screens via shortcuts while enjoying your website’s front-end.
Once users view your public pages on the site’s front-end. The admin bar can cause confusion for users. In addition, it also has a negative effect on your site’s design and user experience. So, how to hide this bar for all users except administrators. Let’s keep reading.
How to Disable WordPress Admin Bar for All Users except Administrator
Fortunately, there are numerous methods to help you hide or disable the WordPress admin bar for all users except administrators. In today’s guide, we will show you three simple methods to handle this issue. Now, let’s check them out.
Method 1: Disabling the WordPress Admin Bar for Any User from your dashboard
By default, WordPress permits each user to hide the admin bar by editing their user profile. In addition, WordPress also allows the site owner to edit other users’ profiles and even hide the admin bar for them.
If you would like to hide the admin bar for any specific user in WordPress, you can follow the steps below to edit their user profile.
Firstly, you need to visit the Users > All Users page, and then let’s click on the “Edit” link displayed below for any user that you want to disable the admin bar for them.
Then, this takes you to the user profile editor screen. Let’s go down to the Toolbar section. From here, you need to uncheck the box displayed next to the “Show toolbar when viewing site” option.
After that, scroll down to the bottom of the page and click the “Update User” button to finalize the process.
Scroll down and click the ‘Update User’ button to save your changes.
Now, your admin dashboard will be hidden for that particular user when they experience your website.
This will disable the admin bar for that particular user when they visit the website.
This method is only useful If your website has a small number of users, then you can manually disable the admin bar for all of them from your WordPress dashboard. Otherwise, you can try other methods below if you are running a membership site that comes with tons of users.
Method 2: Using a plugin to disable the Admin Bar for All users except Admins
In order to use this method, you need to use the support of the Hide Admin Bar Based on User Roles plugin. This tool is very helpful to disable the admin bar for all users based on user capabilities and selected user roles.
Now, you need to follow the steps below to perform:
Step 1: Install and activate the plugin
Installing this plugin is also similar to the process of installing other plugins in WordPress. Firstly, go to Plugins > Add new and then use the search feature to find the “Hide Admin Bar Based on User Roles” plugin.
After that, simply click on the “Install Now” button and activate it.
Step: Configure settings
After installing, you need to navigate to Settings > Hide Admin Bar Settings page. On this page, you can place a tick on the boxes next to the user roles that you want to disable the admin bar.
Then, click on the “Save Changes” button to update your changes.
Method 3: Disabling the admin bar for all users except admins using code
By using this way, you need to add code to your WordPress theme files.
This makes it easy for you to add the following code to your theme’s functions.php file or a site-specific plugin.
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
This code checks whether the current user is not an admin, and then they are not able to view the admin dashboard. After checking, it will disable the WordPress Admin Bar.
Remember to save your changes and visit your site in the front end to make sure everything works properly.
Sum up
We have already offered the 3 easiest ways to assist you to Disable WordPress Admin Bar for All Users Except Administrators. We hope that you can choose a suitable solution from mentioned ones to handle your problem. If you get into trouble with the above methods, don’t hesitate to leave a comment below. We promise to help you as soon as possible. Moreover, it is a great time for you to visit our website to discover tons of impressive, stunning free WordPress Themes for your website.
We’re a Digital Team from EngineTemplate with 5 content experts. Our team has 5 years exp in open source Joomla and WordPress, we make daily blogs and build useful resources for everyone who is having issues with open source while using it.