How to remove the top admin bar in WordPress 3.1

Here is how to remove the WordPress 3.1 admin bar in one line of code:

add_filter( 'show_admin_bar', '__return_false' );

Add that to your WordPress theme functions.php file and you are set.

To have the admin bar show up only for Admin just wrap the one line of code like this:

if (!is_admin())
{
      add_filter( 'show_admin_bar', '__return_false' );
}

I’m sure someone has written an entire plugin to handle one line of code, this just seemed easier.

From "AH YEAH SON!" to "WTF?!?!"
I'm sharing everything on my journey
from $0 to $10k in NEW monthly revenue.

I'm learning a lot and so will you.

Your information will not be shared. Only updates on what we discover will be sent to you, about once a week.

February's Monthly Revenue Update

$0
  • $0
  • $2.5k
  • $5k
  • $7.5k
  • $10k

2 comments

  • Thanks for the one liner! The admin bar is an annoyance when editing (at least for this multi-window user). Cheers!

    -- Toby Barnett

  • donĀ“t need to touch the code.

    You can select that option from “your profile” in the admin area

    -- Juan