Picture of Amir Vincent
Amir Vincent

Amir Vincent is a digital-marketing entrepreneur and the co-founder and CEO of Canada Create™, a Toronto-based agency specializing in SEO, web design, paid search, and social-media strategies for international clients

Need quick help? Let’s Talk About Your Growth

For a faster response, call (416) 273-9030. Otherwise, fill out the form below and our team will contact you.

This field is for validation purposes and should be left unchanged.
Select the Services(Required)

Step-by-Step Guide: Disable WordPress Admin Bar for Non-Admin Users

disablewpadminbar-og

Want to learn how to disable the WordPress admin bar? Read this guide to disable the WordPress admin bar based on user role with a plugin or code.

Many users have inquired about how to disable the WordPress admin bar. Although it’s a minor adjustment, some individuals prefer to do this for reasons such as creating a cleaner interface or improving the experience for non-admin users.

By default, you can easily turn off the WordPress admin bar for individual users. However, this process can become tedious if your site has a large number of registered users.

In this article, we will guide you through the steps to disable the WordPress admin bar for all users except administrators.

What Is the WordPress Admin Bar?

By default, WordPress displays an admin bar at the top of the screen for all logged-in users. When logged into your account, you will see this toolbar in the WordPress admin area as well as on all other pages.

The WordPress admin toolbar provides handy shortcuts to various backend sections of WordPress, and these shortcuts vary depending on the user’s role and permissions.

However, the admin bar can be distracting when viewing the front end of your website.

It may also impact your website’s design and overall user experience. This can be particularly problematic if you are developing or managing a WordPress site for someone else, as it prevents them from seeing the true appearance of their website.

Fortunately, there are several methods to disable the admin bar for all users except administrators. Use the quick links below to navigate to your preferred method:

  • Method 1: Adjust User Permissions in WordPress
  • Method 2: Implement Code to Disable Admin Bar for Non-Admin Users (Recommended)
  • Method 3: Utilize a Free Plugin to Disable Admin Bar for Non-Admin Users

Method 1: Adjust User Permissions in WordPress

You can disable the admin bar for individual users by editing their user profile. This method is quick and effective for a small number of users. However, for membership sites with many users, we suggest opting for a different approach.

To manually remove the admin bar, navigate to the Users » All Users section in the WordPress admin dashboard. Hover over the user who should not see the admin bar and click on ‘Edit’ when it appears.

This will open that user’s profile.

From here, uncheck the box next to the ‘Show toolbar when viewing site’ option.

Next, scroll to the bottom of the page and click on ‘Update User’ to save your changes. This action will disable the admin bar for that individual user only.

To hide the admin bar for additional users, simply repeat the same steps outlined above.

If you want to hide the admin bar for many users, manually adjusting each user’s settings can be time-consuming and labor-intensive.

For this reason, we suggest disabling the admin bar by adding code to the functions.php file, which is a part of your WordPress theme.

Some guides may instruct you to edit theme files directly, but this can lead to common WordPress errors and potentially break your website entirely.

Therefore, we recommend using WPCode. It is the top code snippet plugin that allows you to easily add custom code to WordPress without risking your site’s stability.

We have utilized WPCode to modify the admin color scheme, remove the ‘Howdy Admin’ greeting, disable the Screen Options button, and more.

First, you need to install and activate the free WPCode plugin. For detailed instructions, refer to our step-by-step guide on installing a WordPress plugin.

Once the plugin is activated, navigate toCode Snippets » Add Snippet.

You will find a variety of pre-made snippets that you can easily add to your website.

WPCode offers the perfect code snippet to disable the admin bar, available in its built-in Snippet Library. Simply navigate to Code Snippets » Library.

In the search bar, type ‘Disable The WP Admin Bar’.

Once the appropriate snippet appears, click the ‘Use Snippet’ button.

The plugin will automatically integrate the code into your site, assign a descriptive title to the code, select the appropriate insertion method, and add tags for easy identification of the snippet.

Here’s what the code looks like:

/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );

If your objective is to disable the admin bar for all users, simply switch the toggle from ‘Inactive’ to ‘Active’ and click ‘Update’.

However, to specifically disable the WordPress admin bar for non-admin users, we need to make a few adjustments to the code.

You can substitute the existing code with the following:

/* Disable the 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 targets non-admin users who are not viewing the admin dashboard and disables the WordPress admin bar for them.

Next, scroll down to the ‘Insertion’ section. You can use the default ‘Auto Insert’ method to ensure the code runs site-wide.

Finally, navigate to the top of the screen and toggle the ‘Inactive’ slider to ‘Active.’

Then, simply click the ‘Save Snippet’ or ‘Update’ button to activate the code snippet.

That’s all! Be sure to check your WordPress site to confirm everything is functioning properly.

Method 3: Utilize a Free Plugin to Disable the Admin Bar for Non-Admin Users

If you prefer not to add custom code to your website, you can easily hide the admin bar using a plugin. The ‘Hide Admin Bar Based on User Roles’ plugin allows you to remove the toolbar for various user roles, making it an excellent option for disabling the bar for all members, WooCommerce customers, or specific user roles.

To begin, install and activate the ‘Hide Admin Bar Based on User Roles’ plugin. For detailed instructions, refer to our comprehensive guide on how to install a WordPress plugin.

After activation, navigate to theSettings » Hide Admin Bar Settingspage. Here, select the checkboxes next to the user roles for which you want to disable the admin bar.

Once you’ve made your selections, click on ‘Save Changes’ to apply your settings.

We hope this article has helped you learn how to disable the WordPress admin bar for all users except administrators. You may also want to check out our guide on receiving email notifications for post changes in WordPress, as well as our expert recommendations for the best WordPress activity log and tracking plugins.

If you enjoyed this article, please subscribe to our YouTube Channel for WordPress video tutorials. You can also connect with us on Twitter and Facebook.

Share This Post