How to hide the WordPress admin bar

This is a pretty straightforward how-to. We’ve seen this asked so much around the web and answered so poorly that we decided to try and make it a little clearer.

First of all remember that the admin bar, and by this we mean the grey bar at the top of your WordPress site is only visible to logged users. All regular visitors will not see it. That bar is there only to aid site editors and admins.

Also, since WordPress 3.3 it is no longer called the Admin bar, it’s now called the Toolbar. You’ve been warned.

 

So the incredibly simple way to hide this bar is seen in the image below:

hide-admin-bar

As you can see there’s no PHP code that you must insert, there are no CSS tricks you must do and there’s no plugin that you must install. It’s a WordPress option. Did you really think the WordPress guys would deprive you of such an option?

Anyway, in writing this is what you have to do: go to your WordPress dashboard >> Users >> Your Profile and uncheck the “Show Toolbar when viewing site”. Save and that’s it.

Disable the Toolbar globally

So you’re saying you have a lot of users and editors and you’re tired of hearing them complain about it? Or maybe you just wanna feel powerful and make sure that no one will ever see that hideous admin bar on your site ever again? Well then you’ll have to get your hands dirty. Well maybe just one finger. Actually just the tip.

There’s just this simple code that you must paste in your current theme’s functions.php file:

<?php show_admin_bar(false); ?>

Isn’t it funny how the officially named Toolbar is hidden by using the show_admin_bar() function?

Taking things further

So to take things a bit further, just like I said in the title above, you may want to hide this bar only for users with certain rights. So for example if you want to hide the bar for users that can’t edit posts you’d have to replace that code with this:

if (!current_user_can('edit_posts')) {
    show_admin_bar(false);
}

There are many rights that users may or may not have in WordPress. For a more in-depth lesson read about user Roles and Capabilities straight from the WordPress.org site.

Well, these are pretty much all the ways in which you can hide the Toolbar. You can even hide it twice if you want to. You know, just to make sure it won’t jump in and surprise you when you’re least expecting it. But remember, all this is valid for the front-end of your site – the part that’s visible for everyone. In the admin section it’s not hide-able at all nor is it recommended to remove it. So it will always be there, watching everything you do, every word you type… every comment you delete… every post you change the date of…

More Tutorials This article is part of our WordPress general and theme specific tutorials series. For more useful information check out our tutorials section.

16 Comments

  1. WordPress 4.2.2 running Nirvana Child theme.

    It is recommended not to edit functions.php. Tried editing admin-bar.php but no change. Installed and activated “Admin Bar Hide” plugin which removed the top toolbar menu, however, the toolbar is still present for “Login”, “Logout” and “Search”.

    For the life of me why a WordPress site should display the ugly top toolbar is crazy. And to have no easy way to globally hide it.

    Any help would appreciated to hide the toolbar.

  2. Hi,
    This is the updated version on WordPress website. Just add the following to the bottom of the wp-includes/admin-bar.php file as its own function and it will work.

    function my_function_admin_bar($content) {
    return ( current_user_can( ‘administrator’ ) ) ? $content : false;
    }
    add_filter( ‘show_admin_bar’ , ‘my_function_admin_bar’);

    This will hide the toolbar from everyone that is logged into WordPress as a user but will not hide it from the administrator.

    P

    1. It is a very bad idea to edit core WordPress files.
      And you’ll lose the changes on the next update anyway…

      The same code can be added in a plugin you write or in a child theme.

  3. As an admin I sometimes want to see it, and sometimes not. I want a simple toggle switch so that I as the admin can show it or hide it. Something way over to the left or right. There are many times when I want it and then there are many times when it covers over that part of the theme instead of pushing the theme below it.

  4. Seems WordPress 3.6, released about a month aftere the date of this post–killed this ability.

    I’m logged into the admin world, looking at a user page and I don’t see this option.

This article is closed to new comments.