How to Hide WordPress Admin Bar

Are you looking for ways to hide the WordPress admin bar or toolbar?

WordPress toolbar contains links to different pages like the dashboard, menus, custom pages, widgets, themes, edit posts & pages, create new posts and pages, etc. 

Despite its usefulness, the toolbar can be an annoying presence on your screen. 

For developers working to improve the design of the website, the toolbar can ruin the look of the page they are editing. Certain users like subscribers even don’t require access to the backend of the site, so the presence of the toolbar is futile. 

If the toolbar is not required, it’s best to remove or hide it from your website. In the tutorial below, you will learn how to hide the WordPress toolbar from your screen using a variety of methods. 

How to Remove WordPress Admin Bar or Toolbar

Being an open-source software, WordPress has a lot of flexibility. This means there is more than one way to remove the toolbar. You can remove the toolbar by:

  • Using the WordPress dashboard or 
  • Installing a plugin or
  • Inserting a code into the function.php file

We are going to show you how to remove the admin bar using all the methods.

Now, let’s get started. 

Removing Toolbar From Dashboard 

This method is ideal when hiding the WordPress admin bar for only a few users. However, to remove the toolbar for a large number of users, we recommend that you skip this method and follow the steps listed in the next section. 

Step 1: Open your dashboard and go to Users, choose All Users, and select the user you want to remove the toolbar for. 

Step 2: On the next page, there is a Show Toolbar option. Uncheck that option

Then scroll down to the end of the page and hit the Save button. And that’s it. 

toolbar option in user profile page

Removing Toolbar Using a Plugin 

This particular method is best implemented when you want to hide WordPress admin bar for specific user roles, for every user, or every user barring admins.

For Specific User Roles

To hide the toolbar for specific user roles, install this plugin on your WordPress website: Hide Admin Bar For User Roles

Now, open Settings go to Hide Admin Bar, and select the Hide for Selected User Roles option. 

Next, you should see a list of user roles. Select the roles you want to hide WordPress admin bar for. 

hide admin bar plugin select user roles

For Every User

To hide the WordPress toolbar for every user, you have to install the Hide Admin Bar For User Roles plugin on your website.

Open Settings, go to Hide Admin Bar, select Hide for All User Roles, and Save your changes. 

hide admin bar plugin hide all user roles

For Every User Barring Admins 

To hide WordPress admin bar from every user barring the admins, you have to have the Hide Admin Bar For User Roles plugin installed on your site. 

Open Settings, go to Hide Admin Bar, and select the Hide for Selected User Roles option. 

On the next screen, you should see a list of user roles. Select every role barring Administrator and hit the Save button. 

select roles hide admin bar plugins

Removing Toolbar Using Code Snippet

If you don’t want to install a new plugin on your website and are comfortable editing WordPress files, then go for the code snippet method. It will help you hide the toolbar for specific user roles, for every user, and for every user barring admins.

But before you proceed with this tutorial, you need to take a backup of your entire website. To hide WordPress admin bar using a code snippet you will need to make modifications to your function file. This is a risky business and you can end up with a broken website. If that happens, the backup will be your safety net. So take a backup of your entire website. 

For Specific Roles

To hide the WordPress toolbar for specific roles, you need to insert a code snippet in your function.php file. To access the function file open your dashboard, go to Appearance, and select the Theme Editor option. 

On the next page, you should find the function.php option on the right side of the screen. Select that

theme functions file wordpress dashboard

On the left side of the screen, you should see a small window with a ton of code. Scroll down the window and insert this code snippet at the end of the page (as shown in the image below). 

function tf_check_user_role( $roles ) {
    /*@ Check user logged-in */
    if ( is_user_logged_in() ) :
        /*@ Get current logged-in user data */
        $user = wp_get_current_user();
        /*@ Fetch only roles */
        $currentUserRoles = $user->roles;
        /*@ Intersect both array to check any matching value */
        $isMatching = array_intersect( $currentUserRoles, $roles);
        $response = false;
        /*@ If any role matched then return true */
        if ( !empty($isMatching) ) :
            $response = true;        
        endif;
        return $response;
    endif;
}
$roles = [ 'editor', 'customer' ];
if ( tf_check_user_role($roles) ) :
    add_filter('show_admin_bar', '__return_false');
endif;

Make sure to change ‘editor’ and ‘customer’ to whichever user roles you want. 

editing theme wordpress dashboard

For Every User

To hide the toolbar for every user, insert this code in your theme’s function file: 

/* Disable WordPress Toolbar for every user */

add_filter( 'show_admin_bar', '__return_false' );
edit theme wordpress dashboard

For Every User Barring Admins

To remove the toolbar for all site users barring admins, insert this code in your theme’s function file:

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

With that, we have come to the end of this tutorial.

Conclusion

Hiding the toolbar is useful if you find it distracting or if it’s throwing off the design of your page. Luckily, removing the toolbar from your screen is not too difficult. 

As we have shown in this article, there are three different ways in which you can remove the toolbar from your WordPress website. You can install a plugin insert a code snippet into the function.php file or use the Show Toolbar When Viewing Site option on your dashboard. Use whichever method you are comfortable with. 

That’s it for this one folks. If you have any questions about how to hide WordPress admin bar, let us know in the comment section below. 

sufia banu profile pic leaves background

This is Sufia! I’m a seasoned writer with 6 years of experience in crafting content for WordPress, WooCommerce, plugins, and themes. Besides writing, I love reading, drinking coffee, meditating, working out, and spending time in nature!

Leave a Comment