How To Remove The WordPress Admin Bar

Get our posts emailed to you with our monthly newsletter, subscribe here.

If you are a WordPress user, you may have noticed with the latest update you get an admin bar display on your WordPress site when you are logged in. I actually find this rather annoying, but I can see the benefits, the extra admin menu bar allows you to easily jump into the WordPress admin area without fumbling around with multiple browser windows open.

The two code snippets below allow you to remove the WordPress admin bar from your site completely or remove it from all WordPress users except an admin, I found this to a great little feature, especially if you have multiple users.

Remove The WordPress Admin Bar Completely

1) Open your functions.php file found under ‘Appearence’ -> Editor -> functions.php

2) Insert the provided code into the top of your functions.php file below the PHP opening tags <?php

[php] function my_function_admin_bar(){
return false;
}
add_filter( ‘show_admin_bar’ , ‘my_function_admin_bar’);
[/php]

Show the WordPress Admin Bar To Administrators Only

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

[/php]

Remember to back up WordPress files before editing them, this is a great little code snippet I came accross, I hope it help you!

Posted by Jason Bayless

3 Comments

  1. I’m actually looking for the reverse. I somehow disabled my admin bar and I’m sure it was by a setting I changed in the dashboard.

  2. Thanks!
    This had me stumped because when I upgraded to 3.1.2 it added a white stripe accross the top of my site. It was driving me crazy.

  3. Wow, this is great, I was about to digg into that topic because I don’t like that admin bar either, especially when developing and using tools such as firebug, the code overhead is indeed annoying.

    Thanks for the great info!

Comments are closed.