How to Hide the Admin Toolbar for WordPress Users

WordPress sites display an admin toolbar for all logged-in users. This is visible on the frontend of your site and also in the WordPress admin area.

This toolbar contains shortcuts to key features in WordPress. A user in the Subscriber role will only see a few features. A user in the Administrator role may see a very busy toolbar, particularly on a site with many plugins. This image below shows my toolbar here at PublishPress.com:

My Pp Toolbar
My Pp Toolbar

This next image shows what a user in the Subscriber role will see on a new WordPress site.

Subscriber Toolbar
Subscriber Toolbar

If you want more details on this, check out our guide to what users see in the Admin Toolbar.

If you want to hide this toolbar for users on your site, read on. We have three different options for you:

  1. Hide the admin toolbar for one user.
  2. Hide the admin toolbar for user roles.
  3. Hide the admin toolbar using code.

Option #1. Hide the Admin Toolbar for One User

The simplest option allows you to remove the toolbar for a single user. This allows you to hide the toolbar on the frontend of the site.

  • Go to “Users” in the main admin menu.
  • Click “Edit” for any user.
Edit Users
Edit Users
  • Uncheck the “Show Toolbar when viewing site” box.
  • This user will be able to see the toolbar inside the WordPress admin area. However, they will not be able see it when looking at the front of your site.
Show Toolbar
Show Toolbar

Option #2. Hide the Admin Toolbar for User Roles

Here on PublishPress.com we only allow Administrators to see the toolbar. To make this happen, we use a plugin called PublishPress Capabilities.

  • Install the PublishPress Capabilities plugin.
  • Go to Capabilities > Admin Features in your WordPress menu.
  • Choose a user role from the dropdown box in the top-left corner.
  • You can now check the box for any toolbar you want to disable for this user role:
Admin Toolbar Restrictions
Admin Toolbar Restrictions

Option #3. Hide the Admin Toolbar with Code

If you want to use code to remove the Admin Toolbar, you can add the following line to your theme's functions.php file. This will hide the toolbar for everyone on your site.

add_filter('show_admin_bar', '__return_false');

You can also approach this in a more granular way, and hide the toolbar for everyone except for Administrators:

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}

Alternatively, you can also rely on the User Role Level feature in WordPress. Earlier in this post, we mentioned the “Hide Admin bar from Non-Admins” plugin. The code in that plugin works by only showing the toolbar to users with a role level below 9:

function habfna_disable_admin_bar()
{
	if(!current_user_can('administrator'))
	{
		add_filter( 'show_admin_bar', '__return_false' );
		add_action( 'admin_print_scripts-profile.php', 'habfna_hide_admin_bar_settings' );
	}
}
add_action('init', 'habfna_disable_admin_bar', 9);

Note: Some Plugins Hide the Admin Toolbar

When you are changing who can see the Admin Toolbar, it's worth noting that some plugins will hide the toolbar. For example, WooCommerce hides the Admin Toolbar for several user roles. So before making any of the changes suggested in this post, I recommend testing your site to see who can see the Admin Toolbar. This is easy to do with the User Switching plugin installed.

Finally, if you're cleaning up your WordPress admin area, check out how to hide WordPress admin menus, hide meta boxes, and hide dashboard widgets.

Leave a Reply

Your email address will not be published. Required fields are marked *