WordPress 3.1 – How To Remove or Disable the Admin Bar

All of our themes are compatible with the new Wordpress 3.1.  Please note however,  the new addition of the Admin Bar on your site's front end may cause the normal page elements to appear 28 px lower.   This is only visible to you, the admin, when you are logged in.   If you log out, the page appears perfectly aligned as usual.  *Note the addition of wp-includes/admin-bar.php

If you wish to remove the new 3.1 Admin Bar from appearing on the frontend of your site when you are logged in, please do one of the following.

1) Go To "Users" and uncheck the box next to "Show Admin Bar"  This will only affect the Admin Bar setting when you (being that specific user) are logged in.

2) If you have multiple users and wish to disable the Admin Bar for ALL users without having to change this option in each one's User settings, open functions.php and add the following code:

add_filter( 'show_admin_bar', '__return_false' );

If you would like to remove the "Show Admin Bar" checkbox option and prevent it from displaying in the "Users" section entirely, add the following code to functions.php

remove_action( 'personal_options', '_admin_bar_preferences' );


13 comments
for this post.
    • Hi there,

      great tip but where exactly in the file should I drop in the code:

      add_filter( ‘show_admin_bar’, ‘__return_false’ );

      I’m no coding type of fella!!

      cheers,

      ian

      Lucca Reply:

      Anywhere after the first <?php tag.

      Ashley Reply:

      Here Ian,

      Copy and paste this into a blank.php document and save it in you plugins folder, if you do it this way it will work with all your themes not just one

      Ashley Reply:

      Ashley Reply:

      /*
      Plugin name: Remove admin bar
      */

      add_filter( ‘show_admin_bar’, ‘__return_false’ );

      It didn’t copy so remember to add the php tags at the top and bottom

      Josh Reply:

      Works too if you just put it in your theme functions.php

    • That is much better. Just one thing though, I still have a narrow gray bar at the top of the page. Anyone know how to get rid of it?

      UKFreeListings Reply:

      Woops, gray bar was mine – fixed it.

    • Thanks for this, I didn’t want that admin bar on the front page so I added this code to the front-page.php template. Worked like a charm!

    • Thanks this is helpful to me

      Go To “Users” and uncheck the box next to “Show Admin Bar”

    • Hi,
      There are a few plugins available to do this for you, BUT they will not be as efficient as putting the code directly into your header.php which is the most efficient placement as it only loads for front end pages, or in to your functions.php file which is the given standard. However, you can use Plugins like: Admin Bar Disabler, Custom Admin Bar or Admin Bar Removal for this.

    • If there some plugin for Buddypress to dissable such admin bar and leave Buddybar working?

      Please any opinions…

Leave a comment
Leave a Message
* Name
* Email (kept private)
Website Address
*