How to remove WordPress admin bar

WordPress 3.1 introduces a new admin bar which is located at the top of your site. Some people like the admin bar and some don’t. Here are two ways of removing it. One by adding code to your themes functions.php and one by simply tick a checkbox from your profile page.

Put this code in your themes functions.php to remove the admin bar.

add_filter( 'show_admin_bar', '__return_false' );

You can also extend this code by adding conditional statements to further control when to show or hide the admin bar. This example hides the admin bar when viewing the site.

add_filter( 'show_admin_bar', '__return_false' );

This example hides the admin bar for non admin users.

add_filter( 'show_admin_bar', '__return_false' );

Of course you can combine them as you want. Check out WordPress roles and capabilities and conditional tags for more ways of controlling this.

The other way of removing the admin bar is from your profile page. From here you can choose to remove the admin bar completely or show it when viewing the site or when in dashboard.

WordPress Show Admin Bar

WordPress Show Admin Bar

Update 2011-03-21
Add the following code to your themes functions.php if you want to hide the admin bar option from the user profile.

add_action( 'admin_head', 'hide_admin_bar_settings' );
function hide_admin_bar_settings() {
	<style type="text/css">
		.show-admin-bar {
			display: none;

About Fredrik Malmgren

Fredrik Malmgren is an entrepreneur, project manager and developer specialized in WordPress. Read more about me or get in contact with me. You can also find me on Twitter. (@fredrikmalmgren).
This entry was posted in Tutorials, WordPress and tagged , , , . Bookmark the permalink.

6 Responses to How to remove WordPress admin bar

  1. Thanks mate, very helpfull for building my own wordpress themes, the fastest i guess.. 🙂

  2. Chris Kruse says:

    Why all that code? WordPress has a built-in function for removing the admin bar. Just add the following to your functions.php file.

    show_admin_bar( false );

    • Fredrik Malmgren says:

      Hi Chris,

      I haven’t double checked it but I think the filter calls the function you suggests so it is a matter of taste. I prefer to use filters and it is not that much more code if you just write:

      add_filter( 'show_admin_bar', '__return_false' );

  3. hi!

    thanks for this tip really makes life easier in the WP. Keep em coming!

    thanks guys!

  4. cardbaba says:

    Exactly the one i was looking for…thank you for sharing

  5. antoinette says:

    I could not believe it when I updated to 3.1 and suddenly that admin bar popped up to annoy me! It was just not obvious how to get rid of it. Thought it needed php to change it, but the tick box option in my profile page will be the way I do it (as a non techie). Many thanks.

Leave a Reply to Fredrik Malmgren Cancel reply

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