How to Hide WordPress Admin Bar for All Users Except Admin

Are you wondering how to hide the WordPress admin bar excerpt admin?

Although, by default, you can easily disable the WordPress admin bar for individual users. However, if your WordPress site has many registered users, it may take some time.

In this article, we’ll show you different methods for how to hide the WordPress admin bar for all users except administrators.

Let’s dive in!

What is WordPress Admin Bar?

The WordPress Admin Bar, also known as the Admin Toolbar, is a feature in WordPress that offers quick access to various administrative functions and tools while you are logged into the WordPress dashboard. It appears at the top of your site when you are logged in as an administrator or a user with appropriate permissions.

The Admin Bar includes a set of menus and shortcuts that allow you to perform various tasks without navigating through the WordPress dashboard. Some common elements found in the WordPress Admin Bar include:

  • Site Title and Logo: Clicking on the site title or logo takes you to the homepage of your site.
  • + New: This dropdown menu allows you to quickly create new posts, pages, media, and other content types.
  • Edit Page/Post: If you are viewing a page or post on your site while logged in, this option allows you to quickly access the editing screen.
  • Comments: Shows the number of pending comments, and you can click on it to manage comments.
  • Updates: Alerts you if there are any available updates for WordPress core, themes, or plugins.
  • Profile: Allows you to access your user profile, change your password, or log out.
  • And many more options.

How to Hide WordPress Admin Bar

There are two methods for hiding the WordPress admin bar. The easiest method is to install a plugin, whereas the difficult way is to manually insert a code snippet. We’ll show you both methods.

But, before we start, we strongly advise you to make a backup of your complete website. In this part, you will have to access the backend of your website and edit files, which is a dangerous business. Even adding a new plugin is not without risks since fresh installs have been known to cause website crashes. So, create a backup of your website right away.

Check out some backup plugins for WordPress you can use for your site if you haven’t one.

Once create your backup, let’s check out the different methods to disable the WordPress admin bar.

Method 1: Hide WordPress Admin Bar for a Specific User

You can disable the admin bar for certain users by updating their user profiles. This is a quick and simple method for removing the bar for a small group of individuals. However, if you run a membership site with a large number of users, we advise a different approach.

To manually remove the admin bar, go to Users » All Users. Then, hover your cursor over the user who does not require the admin bar and click Edit when it appears.

Edit User in WordPress

This will bring up that user’s profile.

Next, uncheck the box next to the Show toolbar when viewing site option.

Hide Admin Toolbar for Individual User in WordPress

Then, scroll to the bottom of the screen and click Update User to save your changes. This will disable the admin bar for only that individual.

To hide the toolbar for more users, simply repeat the previous steps.

Method 2: Disable Admin Bar for All Users Except Admins with a Plugin

This method allows you to disable the WordPress admin for all users quickly.

First, you need to Install and Activate the Hide Admin Bar Based on User Roles plugin. For more details, see our guide on how to install a plugin in WordPress.

Hide Admin Bar Based on User Roles WordPress Plugin

Upon activation, go to the Settings » Hide Admin Bar Settings page. Select the user roles you want to prevent from accessing the WordPress dashboard and Save your settings.

Hide Admin Bar Based on User Roles Settings

Method 3: Disable Admin Bar for All Users Except Admin Using Code

Installing and managing new plugins may be a headache. If you don’t like installing new plugins on your WordPress site, we suggest using the manual method of adding a code snippet to hide the WordPress admin bar.

Add the following code snippet 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 or not the current user is an administrator and is not viewing the admin dashboard. If both requirements are met, the WordPress admin bar is disabled.

Remember to save your changes and verify your website to ensure that everything is working correctly.

Method 4: Hide Admin Bar for All Users Including Admins

You can hide the admin bar for all users, including the admin, by modifying the earlier code.

Copy and paste the below code snippet to your theme’s functions.php file or a site-specific plugin.

add_filter( 'show_admin_bar', '__return_false' );

This code will hide the admin bar for all users when viewing your website’s public pages. All users will still see the toolbar inside the WordPress admin dashboard.

Final Thoughts on How to Hide WordPress Admin Bar

The WordPress admin bar is a great tool, but it may sometimes cause more destruction than help. As a result, removing it may be a better option. You may always enable it by uninstalling the plugin or code snippet that helped you hide it in the first place.

If you do need to enable it, make sure to back up your site first before making any changes.

That’s it from this article.

For more, check out these other helpful resources:

Lastly, follow us on Facebook and Twitter to stay updated on the latest WordPress and blogging-related articles.