How to Disable the WordPress Admin Bar for All Users Except Administrators

As an experienced WordPress webmaster, I often get asked how to disable the admin bar that appears across WordPress sites.

This toolbar can be useful for quickly navigating your site. But it also takes up precious space and can make WordPress sites look messy.

After 15 years working with WordPress, I‘ve found some great methods for controlling the admin bar. In this guide, I‘ll share insider tips to hide the toolbar for different users or scenarios.

Weighing the Pros and Cons of the Admin Bar

The WordPress admin bar appears at the very top of the screen when logged in. It provides shortcuts based on capabilities and screen.

For Administrators, the bar grants fast access to:

  • Dashboard
  • Creating new posts, pages, media
  • Editing the current page
  • Moderating comments
  • Your profile
  • Logging out

For other users, it mainly displays:

  • Notification alerts
  • Their profile
  • Log out

The Benefits

The admin bar can be beneficial for:

  • Quickly jumping between admin and front-end areas
  • Fast publishing and editing
  • Quick comment moderation

The Downsides

But it also has some drawbacks:

  • Takes up prime real estate on all pages
  • Can disrupt site branding and design
  • Looks messy on live sites

Based on 15 years as a WordPress professional, I recommend controlling the admin bar smartly based on your specific needs.

Next I‘ll share techniques to hide it for certain users and scenarios.

Method 1: Disable for Individual User Accounts

The quickest way to remove the toolbar is on a per-user basis.

You may want to hide it for certain members or test accounts without impacting admins.

To disable for individual users:

  1. Go to Users > All Users
  2. Hover over the username and click Edit
  3. Scroll down and uncheck Show Toolbar
  4. Click Update Profile

This removes the toolbar whenever that user is logged in and visiting the front-end of your site.

Pro Tip: Create a dedicated test user to preview your site without the bar.

I‘d recommend toggling the toolbar for individual accounts if you only need to hide it for a handful of users.

Method 2: Disable by User Role Using Code

A better approach for larger sites is to hide the bar for entire user roles.

For example, you may want to remove it for all Subscribers but keep it for Admins.

Using a simple code snippet lets you disable the toolbar for specific roles in one swoop.

Step 1: Install the Code Snippets Plugin

To add custom code safely, install the Code Snippets plugin. This gives you an easy way to add PHP without editing core files.

Over 5 million WordPress sites use Code Snippets to insert custom functionality while avoiding errors.

Step 2: Create a New PHP Snippet

Once activated, go to Snippets > Add New to create a new snippet:

  • Give it a title like "Hide Admin Bar by Role"
  • Select PHP for the language
  • Set insertion to Auto Insert

This inserts your snippet site-wide automatically.

Step 3: Add Role-Based Admin Bar PHP Code

Next, add the following code to hide the toolbar for a specific role:

add_action(‘after_setup_theme‘, ‘remove_admin_bar‘);

function remove_admin_bar() {
  if ( !current_user_can(‘administrator‘) && !is_admin() ) {
    show_admin_bar(false); 
  }
}

This checks two things:

  1. The user is NOT an Admin
  2. We‘re NOT in the WordPress dashboard

If both are true, the admin bar is hidden.

Step 4: Update with Your Target Role

To change the role, swap out administrator for the capability of any role:

  • editor
  • author
  • contributor
  • subscriber

So for Subscribers, you‘d use:

if ( !current_user_can(‘subscriber‘) && !is_admin() ) {
  // Hide admin bar
}

Step 5: Activate Your Admin Bar Code Snippet

Finally, activate your snippet and it will remove the toolbar for your chosen role across the site.

This approach allows you to toggle the admin bar for whole user groups in just a few minutes!

Method 3: Completely Disable the Admin Bar with a Plugin

Want to remove the WordPress toolbar for all users everywhere? A dedicated plugin makes it easy.

The Admin Bar Remover plugin includes an option to completely disable the admin bar across your site.

Over 70,000 WordPress sites use it to fully hide the toolbar for all visitor types.

Why Completely Remove the Admin Bar?

You may want to fully remove the bar if:

  • It negatively impacts your design
  • You build sites for clients
  • You want a distraction-free editing experience

How to Use Admin Bar Remover

Using the plugin takes just a minute:

  1. Install and activate Admin Bar Remover
  2. Go to Settings > Admin Bar Remover
  3. Check the box for Completely Remove Admin Bar
  4. Click Save Changes

This will fully remove the toolbar across your site for all visitor types.

It‘s the quickest way to completely declutter the admin bar from your site.

Method 4: Conditionally Show/Hide the Admin Bar

For complete control, you can use custom code to conditionally show or hide the toolbar in specific scenarios.

This allows you to toggle the bar based on:

  • Specific pages or templates
  • Whether the user is logged in
  • Certain user roles
  • On the front page only

Let‘s explore some common conditional examples:

Hide on All Pages with Certain Template

To remove the toolbar from all pages using a specific template:

if (is_page_template(‘template-name.php‘)) {
  show_admin_bar(false);
} 

Show for Admins Only

To display the admin bar for Admins but hide it for other roles:

if (!current_user_can(‘administrator‘) { 
  show_admin_bar(false);
}

Hide on Front Page

Removing the toolbar from your homepage only:

if (is_front_page()) {
  show_admin_bar(false); 
}

Hide for Logged Out Users

To remove for non-logged in visitors:

if (!is_user_logged_in()) {
  show_admin_bar(false);
}

There are many WordPress conditional tags to achieve just about any admin bar toggle you need.

Final Thoughts

Controlling the WordPress admin bar is a great way to tailor sites for your specific needs.

As a professional working with WordPress for 15+ years, my top recommendations are:

  • Hide for select user accounts using profile editing for simple one-off tweaks
  • Disable by role using code snippets for managing access for large user groups
  • Completely remove using a dedicated plugin if you want it gone entirely
  • Conditionally show/hide using custom code for fine-grained control

Hopefully this guide gives you a better understanding of your options to hide the admin toolbar in different use cases.

Feel free to reach out if you have any other questions! I‘m always happy to help fellow WordPressers master their sites.

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.