in WordPress

Remove The WordPress Admin Bar

In Wordpress 3.1 they introduced an admin bar which is displayed at the top of window if you are logged in as an admin and are not currently in the admin area. This is a quick way to access the main admin links from any page of your Wordpress site. The Admin bar has default links to:

  • Dashboard
  • Add a new post
  • Comments
  • Plugin Updates

    It is possible to add you own links to this admin bar so for more quick links to any thing you use regularly. But you might want to hide this from certain users apart from the one admin account. Copy the following code snippet into your Wordpress functions.php to hide the admin bar from all users apart from the Admin user.

    global $current_user;

    if (!current_user_can( 'manage_options' )) 
        add_filter( 'show_admin_bar', '__return_false' );

Another option to use is to disable the admin bar for all your users by removing the action which adds the bar, add the following into your functions.php page.

remove_action('init', 'wp_admin_bar_init');

You can always remove the admin bar by using the show_admin_bar filter, if you return false from this filter then it will hide the the admin bar. This can be done by using _return_false as the callback to this filter.

add_filter( 'show_admin_bar', '__return_false' );

Use CSS To Hide Admin Bar

Instead of using your PHP functions.php file to hide your admin bar you can use CSS to simply hide the bar. As this bar will only be seen by logged in users and not search engines it doesn't matter about the time it might take load the admin bar. The problem with using CSS is that the admin bar will be hidden for all users on your Wordpress blog and it will only stay hidden for this one theme. If you want to hide the admin bar with your CSS file then use the following snippet.

#wpadminbar { display:none !important;}

It's important to note the security risks of doing this, if you remove the admin bar then it makes it more difficult for the user to log out of WordPress. If they can't log out and are using a shared computer then another user could use their computer and have access to your WordPress admin area. There are ways you can still logout but this involves navigating to the log out page which can be accessed by going to This isn't ideal when logging out of your WordPress site so make sure that you understand about logging out in this way before you remove the admin bar.

Subscribe To The Weekly Newsletter

Get weekly updates to your email