Looking for ways to disable WordPress Admin bar for all users except administrators? Then you are at the right place.
The WordPress admin bar can be a useful tool for administrators, but for regular users, it often creates more confusion than convenience.
This unnecessary interface can result in accidental clicks or changes, making it a real headache for both users and site owners.
So, in this article, we’ll look at some of the best ways to disable the WordPress admin bar for non-administrators.
Are you ready? Let’s get started!
What is WordPress Admin Bar?
The WordPress Admin Bar is that handy little black bar that appears at the top of your screen whenever you’re logged in to your WordPress site. It’s visible on both the backend and the frontend.
Think of it as your quick access tool that lets you jump to the most common tasks in just one click.
WordPress admin bar is the fastest way to manage your WordPress site. You don’t need to go back to the dashboard every time you want to add something new or check notifications.
Once you’re logged in, it’s always there, helping you navigate your site faster. Also, you can control who can see the WordPress Admin Bar based on user roles.
This means you can choose to hide it for specific users, like subscribers or customers while keeping it visible for admins and editors.
Reasons to Disable WordPress Admin Bar for Non-Administrators
Disabling the WordPress admin bar for non-admins can have several benefits.
- Cleaner Frontend Experience: If you’re building a website for clients or users who aren’t supposed to see backend tools, like subscribers, contributors, or even customers, showing the admin bar on the front end might confuse them. Disabling it gives them a cleaner, distraction-free view.
- Avoid Accidental Changes: Let’s say you have multiple users with different roles on your WordPress site. You may not want certain users (like authors or editors) to accidentally mess around with settings they don’t need. By hiding the admin bar, you reduce the chances of them clicking on something they shouldn’t.
- Speeds Up Page Loads for Non-Admins: For users who don’t need backend access like subscribers, displaying the admin bar can add extra load time to each page. Disabling it for these users helps speed things up, especially if your site is already content-heavy.
- More Control for Developers or Designers: If you’re a developer or designer working on the site, you might disable the admin bar for clients or users so they don’t tamper with it.
- Consistency Across User Roles: You may want to maintain a consistent experience for certain user roles. For instance, if subscribers or contributors don’t need access to editing tools or settings, hiding the admin bar aligns with the permissions you’ve set for them.
- Improved Mobile View: The admin bar on mobile can sometimes take up valuable screen space, making it harder to view your website’s front end. If you’re browsing the site on a small screen, you may prefer a clean view without the admin bar getting in the way.
Want to disable it for All users? Read: How to Hide the Admin Bar in WordPress for All Users.
Methods to Disable WordPress Admin Bar for All Users Except Administrator
Here are the easy ways to disable the admin bar for all users except administrators.
Method 1: Using a Free Plugin
Using a free plugin is one of the easiest and fastest ways to disable the WordPress admin bar for all users except administrators. Here are the steps to follow:
Step 1. Install and activate the Hide Admin Bar Based on User Roles plugin on your WordPress site.
Step 2. In the sidebar, Click on Settings > Hide Admin Bar Based on User Roles
Step 3. Now, in the Hide Admin Settings, check all the boxes except the administrator to disable the admin bar for all the other users. Click Save Changes.
That’s it, except administrator, no other user will be able to see the admin bar.
Method 2: Adding a PHP Code
If you are a developer or anyone familiar with coding then this method is for you. This is also an easy method but editing your Theme files manually can cause major WordPress errors or you might lose your WordPress site too if not done cautiously.
So we recommend you use the Code Snippet feature by Nexter Extension. It will allow you to easily add PHP code to your WordPress site without creating any child theme.
So to add PHP code without modifying your original theme file to disable the WordPress admin bar for non-administrators simply follow the steps.
Step 1. Install and activate the Nexter Extension plugin on your WordPress site.
Step 2. In the WordPress dashboard, navigate to Nexter Builder and click on Add New
Step 3. Scroll down the page and click on Code Snippets at the bottom. Here, you’ll find different languages like PHP, CSS, HTML, and JavaScript. Choose PHP, then in the Code Execute section, you can select where you want the code to run. In this case, select ‘Only Front-end‘ from the options.
Lastly, in the PHP code section copy the code given below and publish the template.
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 disables the WordPress admin bar for users who are not administrators when they visit the front end of the site by checking if the current user is an administrator or not.
Struggling to add code snippets? here’s How to add Code Snippets for FREE in WordPress (HTML, CSS, JS & PHP)
Method 3: Manually Changing User Settings
To disable the WordPress admin bar for specific users, you can change their settings directly from the WordPress dashboard. This method is straightforward but may become tedious if you have many users.
To do so,
Step 1. Simply navigate to your WordPress dashboard and go to User > All Users
Step 2. Next, Choose the user whose settings you’d like to change by clicking on their username and click on the Edit link.
Step 3. In the Edit user settings, look for the Toolbar option uncheck the Checkbox saying Show Toolbar when viewing the site scroll to the bottom, and click on Update User.
Repeat the same process for all the users to remove or disable the admin bar for the non-administrators.
Imagine! Your whole admin dashboard is just made for your suited needs It sounds unreal, right? No, it’s not, you can easily customize your WordPress admin dashboard however you like and improve your workflow and productivity.
Stay updated with Helpful WordPress Tips, Insider Insights, and Exclusive Updates – Subscribe now to keep up with Everything Happening on WordPress!
Wrapping Up
That’s all, we hope that this article helped you to remove the WordPress admin for all users except administrators.
The only main reason for disabling the admin bar is to manage your site’s user experience. There are mainly 3 ways by which you can remove or disable it very easily.
- By using a Plugin like Hide Admin Bar Based on User Roles
- By adding a PHP code to your theme file.
- By manually changing the user settings.
You can use any of the methods mentioned above, but if you are going to add PHP code to your theme file, be extra cautious because it can lead to major site errors if not done properly.
Pro Tip: Instead of editing your theme file directly, use a code snippet plugin to avoid potential errors or disruptions to your site.
Moreover, if you are a pro at building websites using Gutenberg and want to take your web design to the next level, we highly recommend using Nexter Blocks.
With its 90+ Gutenberg Blocks, website building using the Gutenberg Block editor has never been easier. Start creating stunning websites today.
FAQs on Disable WordPress Admin Bar for All Users Except Administrator
Where is the WordPress admin bar?
The WordPress admin bar is the black bar that appears at the top of the screen when you’re logged into your WordPress site. It shows up on both the backend (dashboard) and the front end (your site pages).
Can disabling the admin bar improve website performance?
Yes, it can slightly improve performance, especially for non-admin users, by reducing what’s loaded on the page.
Is it safe to add PHP code to disable the WordPress admin bar?
Yes, but be careful. Instead of directly making changes to your theme file using Code Snippets plugins is recommended
Is there a plugin to disable the WordPress admin bar for specific user roles?
Yes, you can use plugins like Hide Admin Bar Based on User Roles to easily control who sees the admin bar.
Can I manually hide the admin bar for specific users in WordPress?
Yes, just go to the user’s profile, uncheck the Show Toolbar option, and save the changes.