WordPress 3.1 introduces a new feature called the Admin bar. A lot of people will be wanting to disable this when WordPress 3.1 comes out. Since release candiate 2 you can disable it on a per user basis like this:

But since some people might want to disable the admin bar for everyone, I thought I’d show you a couple of ways to quickly disable the WordPress admin bar, either entirely, or just for you, or just for everyone else.
If you haven’t seen it yet, the WP admin bar looks like this, and is added on top of all pages, on both the frontend and backend of your site, when you’re logged in:
Disable Admin Bar for everyone
This one is reasonably simple, to disable the WordPress Admin Bar for everyone, add the following to your theme’s functions.php file, the first bit hides the admin bar, the second bit hides the settings:
/* Disable the Admin Bar. */
add_filter( 'show_admin_bar', '__return_false' );
<?php function yoast_hide_admin_bar_settings() {
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php
}
function yoast_disable_admin_bar() {
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php',
'yoast_hide_admin_bar_settings' );
}
add_action( 'init', 'yoast_disable_admin_bar' , 9 );
Disable WordPress Admin Bar for specific requests
You might want to do this for specific requests only, so you can more easily take screenshots, for instance, then you add this to your theme’s functions.php file:
if ( isset($_GET['bar']) && 'no' == $_GET['bar'] ) add_filter( 'show_admin_bar', '__return_false' );
This would allow you to disable the WordPress admin bar by going to example.com/?bar=no, you can of course change those values.
Disable WP Admin Bar for specific users
To disable the WP Admin Bar, and the Admin Bar preference on his/her profile page for a specific user, add the following to your theme’s functions.php file:
<?php function yoast_hide_admin_bar_settings() {
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php
}
function yoast_disable_admin_bar() {
if ( 2 == get_current_user_id() ) {
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php', 'yoast_hide_admin_bar_settings' );
}
}
add_action( 'init', 'yoast_disable_admin_bar' , 9 );
Or you could do the reverse, and enable the WordPress Admin Bar just for one user, by disabling it for everyone else:
<?php function yoast_hide_admin_bar_settings() {
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php
}
function yoast_disable_admin_bar() {
if ( 2 != get_current_user_id() ) {
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php',
'yoast_hide_admin_bar_settings' );
}
}
add_action( 'init', 'yoast_disable_admin_bar' , 9 );
Update 7-1-2011: post updated after some remarks about current_user not being set yet at the point I was calling it, switched to using the proper __return_false helper function too, using the helpful comment from Cor van Noorloos in the comments.
Update 7-1-2011 – 2: post updated after an API change was decided upon and then implemented.

it can be disabled, at least in 3.1rc2. view your profile, and uncheck the “show admin bar.”
but definitely useful for killing it all at once or for multiple users
Thanks Caleb, added screenshot of the new interface.
thank you, yoast!
Hi Joost
I think this similar to wordpress.com. I will check how helpful it for my blog. If not, I will surely use your code.
Thanks alot.
Hi Joost,
Not entirely sure what the most recent way to do this is, but removing the admin bar can also be accomplished by
add_filter( 'show_admin_bar', '__return_false' );,And to remove the user setting
remove_action( 'personal_options', '_admin_bar_preferences' );Thanks Cor, used your input in my update of the post above :)
Hi Joost,
AFAIK 3.1. is not released yet, so modification you prosose c an fail to work with the released version. Also option to enable/disable admin bar can be introduced later.
I know, and you know what? This is a content management system, if needed, I can just update the post ;)
Quick question, if you make this change to your theme’s fuctions.php file, and your theme doesn’t have a custom.funtions.php file, then if you upgrade your theme it will get overwritten, right?
Yes.
Wouldn’t a child theme prevent this?
Not sure why, but I’ve never seen that admin bar in my admin panel. I’ve actually WANTED to see it. Anyone know a reversey-ma-hoo to get the admin bar up there?
It’s in WP 3.1 :)
Bah! Just realized I didn’t have it. Thanks :D
Funny. I’ve been adding the WordPress Admin Bar by using the plugin with the same name. I find that it makes things much easier to work. It doesn’t look like the example in your screenshot though. I will have to give it a try and see if it’s better; if not, then I’ll surely come back and use this hack to hide it.
What would be useful is to disable WP admin bar for user roles.
Thanks for your many tips Joost!
I have a WP account now and on bunch of sites the admin bar started showing up.
What are my option as an user?
Or annoying blog owners to disable it is the only option?
Great snippet, thank you Joost!
What about
remove_action( 'init', 'wp_admin_bar_init' );?
When I tried that with WP 3.1 RC2, it got rid of the admin bar, but didn’t remove the gap inserted at the top of the page.
This admin bar is stupid IMO. It seems to replace the existing menu in the WP admin panel, yet the original one is still there. IMO, WordPress should either use the admin bar only, or just use the standard menu in the left hand side. This combination approach is just weird and I don’t like it one little bit.
Maybe it will grow on me in time.
Good stuff, Joost. Bookmarked for future use.
Since changeset 17234, the second part of your first code snippet won’t work. The user preferences will still be visible, unless you use CSS. Time to update the article again :-)
Hi Gary,
I’m afraid your right. CSS would do the trick, but somehow I prefer the jQuery way of doing this.
function cor_personal_options() {?>
jQuery(document).ready( function() {
jQuery( "form#your-profile table.form-table tr.show-admin-bar" ).remove();
} );
<?php
}
add_action( 'personal_options', 'cor_personal_options' );