Catalyst Theme - WordPress Accelerated
banner ad

How to Disable/Remove WordPress 3.1 Admin Bar

| March 1, 2011 More



Recently, WordPress released its 3.1 version which brings a number of new features to our favorite blogging platform WordPress, the main feature that was added being the WordPress admin Bar which is displayed on top of your WordPress blog when you are logged in.

The new WordPress 3.1 Admin Bar makes it easy for the registered users to access their Dashboard, Profile and other common blogging options through a drop down menu.

Different Ways The Admin Bar Appears

What I have come to know from Famousblogger Hesham’s post about WordPress 3.1 update is that a different type of admin bar appears for different user roles who are logged in to our blog.

Lets check each of them:

Admin

Contributor

Subscriber

How to Disable WordPress Admin Bar?

I know many of you do not like that admin bar hanging around there and you may want to disable it so how exactly will we do it.

Simple Disable:

Well this method disables the admin bar per user basis. For example, if you want to disable the admin bar for your account just go to your profile and disable it.

Here is how:

Go to Users > Your Profile > Show Admin Bar

and uncheck on “when viewing site”

Easy as that. But this method disables the admin bar only for that particular user.

How to Disable/Remove Admin Bar Using Plugins?

Just after the release of WordPress 3.1, a number of plugins have come up to delete/disable/hide the WordPress admin bar as well as to modify and relocate it. You can use any the following WordPress plugin to disable/remove your admin bar.

Global Hide/Remove Admin Bar Plugin – Easily add a global option to hide/remove the new Admin bar in WP 3.1+. Adds an option to the Settings Menu to globally turn off the Admin Bar and/or turn off the user option in the profile to show admin bar.

Admin Bar Removal (completely disable) 3.1 only – Completely disables Frontend and Backend Menu that now appears on the WordPress 3.1 based blogs, plus helps to remove code and get more free memory.

Admin Bar Disabler – Disable the WP Admin Bar in 3.1+ entirely, or only for roles and capabilities which aren’t in the ‘whitelist’ or ‘blacklist’.

WP Custom Admin Bar – A really simple and easy to use plugin to help gain control of the new Admin Bar. This gives you options to change who sees the Admin Bar based on their user role, change or override the default styling and remove the Admin Bar altogether.

Admin Bar Minimiser –The Admin Bar Minimiser Plugin was written to help users keep the admin bar active but be able to minimise it at any time to make it less obtrusive.

Stick Admin Bar To Bottom – Annoyed by the new Admin Bar that is covering the top 28 pixels of your website, but you don’t want it completely gone? This plugin sticks the Admin Bar to the bottom of your screen!

Hide Admin Bar Search – Small plugin to hide the search box in the admin bar in both dashboard and site views.

Logged Out Admin Bar -Makes that admin bar always visible even for logged out users. Adds a login button when logged out, the shortlink also displays when available

Always Show Admin Bar – Always shows the admin bar if the user has previously logged in to the site. Non logged in users will see the bar in the normal place, complete with a login link.

How to Disable/Remove Admin Bar Through Code?

Disable Admin Bar Completely for Everyone

If you want to disable admin bar completely for everyone. You can add EITHER of the following codes  into the functions.php of your current theme:

[php]remove_action(‘init’, ‘wp_admin_bar_init’);
[/php]

OR

[php]add_filter( ‘show_admin_bar’, ‘__return_false’ );
[/php]

Disable Admin Bar Preference In User Profile

If you want to remove the Admin Bar preference in user profiles add this to the functions.php of your current theme:

<?php function hide_admin_bar_settings() {
?>
	<style type="text/css">
		.show-admin-bar {
			display: none;
		}
	</style>
<?php
}
 
function disable_admin_bar() {
    add_filter( 'show_admin_bar', '__return_false' );
    add_action( 'admin_print_scripts-profile.php',
         'hide_admin_bar_settings' );
}
add_action( 'init', 'disable_admin_bar' , 9 );
?>

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 hide_admin_bar_settings() {
?>
	<style type="text/css">
		.show-admin-bar {
			display: none;
		}
	</style>
<?php
}
 
function disable_admin_bar() {
   if ( 2 == get_current_user_id() ) {
      add_filter( 'show_admin_bar', '__return_false' );
      add_action( 'admin_print_scripts-profile.php', 'hide_admin_bar_settings' );
   }
}
add_action( 'init', '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 hide_admin_bar_settings() {
?>
	<style type="text/css">
		.show-admin-bar {
			display: none;
		}
	</style>
<?php
}
 
function disable_admin_bar() {
   if ( 2 != get_current_user_id() ) {
      add_filter( 'show_admin_bar', '__return_false' );
      add_action( 'admin_print_scripts-profile.php',
          'hide_admin_bar_settings' );
   }
}
add_action( 'init', 'disable_admin_bar' , 9 );
?>

Disable Admin Bar According to User Roles

Sometimes you may want to enable/show the admin bar for only a few user levels (Example: who have the rights manage_options). Use the following code:

function fb_show_admin_bar() {
 if ( current_user_can( 'manage_options' ) )
 return TRUE;
 else
 return FALSE;
 }
 add_filter( 'show_admin_bar', 'fb_show_admin_bar' );

Remove or Add an Admin Bar Menu Item

You may also want to add or remove new menu items in theadmin bar for example lets says, you want to Remove the “Comments” link from the WP Admin Bar, or Add a new link to Add New Media under the “Add New” section, we can do something like the following :

function nlk_admin_bar_render() {
global $wp_admin_bar;
// we can remove a menu item, like the COMMENTS link, just by knowing the right $id
$wp_admin_bar->remove_menu('comments');
// we can add a submenu item too
$wp_admin_bar->add_menu( array(
'parent' => 'new-content',
'id' => 'new_media',
'title' => __('Media'),
'href' => admin_url( 'media-new.php')
) );
}
// and we hook our function via
add_action( 'wp_before_admin_bar_render', 'nlk_admin_bar_render' );

Credits to the following websites for the codes:

Control when to display WordPress admin bar
How to disable the WordPress Admin Bar
Disable/enable the Admin Bar for specific users
REmove comments link from WordPress admin bar
- Upgrading Thesis Theme Blog To WordPress 3.1


Share this article

Tags: , , , ,

Category: Wordpress

About the Author (Author Profile)

Kori is the editor and owner of Netchunks, a premier blog about Webmaster and Blogging Tips. She intends to make the web a friendlier place by sharing info and articles which will help other webmasters and bloggers to become successful online.

Comments (63)

Trackback URL | Comments RSS Feed

  1. Fabrizio
    Twitter:
    says:

    Top tip Shiva, it was starting to get annoying each time I previewed my blog through admin, so thanks.
    Fabrizio recently posted..23 Ways to Make Money Online Without Spending a Penny!My Profile

  2. Vuong says:

    Very detailed and useful tips. However, I do not see any reason why you remove the admin bar. It really has many handy functions that allow you to save time during managing blog.
    Vuong recently posted..Creat Favicon With HTML-KITMy Profile

  3. Mani Viswanathan
    Twitter:
    says:

    WordPress should have kept the Admin Bar options as Global Settings rather than Individual settings.
    Mani Viswanathan recently posted..3 Effective Ways to Promote your PostsMy Profile

  4. Ayush Chand says:

    I really had a great problem with it! Easily disabled it from my profile!
    Ayush Chand recently posted..Change Display Name in Gtalk and GmailMy Profile

  5. Saqib
    Twitter:
    says:

    Thats really a great list of plugins. But I would prefer to disable it by editing functions.php. Why use plugin, when you can do it with a simple code.
    Saqib recently posted..What is HDFC Netsafe Virtual Credit Card and How it WorksMy Profile

  6. Gustavo says:

    Right now, I have the Toolbar disabled.

    I’m the type of persons that takes a while to get used to new things, and so far I don’t see how it will help me to be more productive.
    Gustavo recently posted..Recuva- Recover Deleted FilesMy Profile

    • Shiva Chettri
      Twitter:
      says:

      It depends on people’s preference. I find it useful since I can easily switch between my dashboard and blog. (I am quite lazy and this update has made me even lazier, saves me from typing /wp-admin again and again…lol

  7. Mark says:

    Nice stuff. That toolbar is a bit annoying to me
    Mark recently posted..iGUGU InterneTV is now availableMy Profile

  8. Dana says:

    For me, admin bar is quite good so will not remove it. However, there are some people may be not like it so this article will be a big help for them.
    Dana recently posted..Motorola XOOM Debut on Verizon WirelessMy Profile

  9. aatif
    Twitter:
    says:

    When i upgraded my WP i was amazed why i there is a bar on top !! after searching i got to know it is new feature . thanks for the article i would like to disable it .
    aatif recently posted..Top Commentators Award For February 2011My Profile

  10. Soo many plugins came to remove admin bar.. :P
    Don’t know why ppl want to remove it but I found it very user stuff..
    Saket Jajodia recently posted..Download YouTube Videos In Very Easy And Simple WayMy Profile

  11. Andrew says:

    I quite like the latest features, actually I met some serious problems in the first 2 days before the other plug ins updates. Thanks for this excellent guide. I really like the admin bar options.

  12. Saksham says:

    Hey thanks for the tip Shiva! :) The bar was really annoying for me.. :D
    Saksham recently posted..Blog FastMy Profile

  13. shah says:

    I see this bar, and see much like bloggers bar. Though I thought this bar is there till I am logged in. Anyways now harm in removing it. Great tips.
    shah recently posted..Skype Voip Calls On HDTV Thanks To PanasonicMy Profile

  14. I am also making a post on admin bar. I think u got the code from yoast.com. there is a mistake in the code.if u paste as it is it wont work. “?>” has to be added at the end of “disable admin bar” function. check it u will understand.
    Mukundan Srinivasan recently posted..Automatically Alert Your Users about New Blog PostsMy Profile

  15. Jasmine says:

    I don’t like the admin bar too… gonna hide/remove it. :)
    Jasmine recently posted..KnownHost Managed VPS HostingMy Profile

  16. James says:

    I like this new feature and I think it is not a good idea to remove it, it can save a lot of time. Everything is on your fingertips.
    James recently posted..How to Earn Revenue From a SEO Reseller ProgramMy Profile

  17. I still haven’t decided whether I like this new feature yet. It has it’s good points and bad.

  18. Anne Sales says:

    Wow, I didn’t think the admin bar would be met with different attitudes. I thought it was cool. But I can understand if some people get annoyed by it. We all have different preferences and it’s nice to know other people’s view especially if they are not the same as yours.
    Anne Sales recently posted..Lufthansa voucher codeMy Profile

  19. Rohit Batra
    Twitter:
    says:

    Nice Tutorial Shiva…thanks for sharing it i will try out when i want to get rid off that Admin Bar…
    Rohit Batra recently posted..Twitterrific App for iPod Touch 4GMy Profile

  20. Jenny says:

    I’ve tried both of these codes:
    [php]remove_action(‘init’, ‘wp_admin_bar_init’);
    [/php]

    OR

    [php]add_filter( ‘show_admin_bar’, ‘__return_false’ );
    [/php]

    But this isn’t working. I tried adding it to my theme’s functions.php file but with no avail. Please help, where exactly I need to put this code in the functions file?
    Jenny recently posted..How to recover Deleted Windows FilesMy Profile

  21. Rajesh says:

    This is something much needed for any wordpress noob who has just started for WP. Thanks for these tips. You have added so many options in the article. Great work.
    Rajesh recently posted..How to bypass Sharecash surveys- Sharecash Downloader serviceMy Profile

  22. I have done it and it works for all the browsers, except Internet Explorer (I am testing on the version 9)

    Have you got any idea about what to do?
    Fabio Neves de Brito recently posted..What is Reinstatement fee (cause of chargeback by the customer)?My Profile

  23. EIA says:

    Thank you for helping me properly destroy that abomination. That damned admin-bar pissed me off enough to scream. I could scream just remembering it.

  24. Mehran says:

    you have posted a very nice tutorial. i think every one need it. i also dont like admin bar. i dont know why they have add it.

  25. Michael from The Local Consultant says:

    Thanks Shiva…

    That Admin bar sure was a pain. I would have thought that WP would have allowed the admin more flexibility by allowing for a global kill switch on the new bar of the admin didn’t like it. Oh well… so long as there are enterprising programmers out there, all these minor items can be handled pretty quickly.

    Great post. I have recently finished a new online training course for the local marketing consultant. This course offers excellent training that teaches people how to become marketing consultants to their local businesses.

    Visit the site at The Local Consultant
    and watch a two minute video that explains The Four Pillars of Local Marketing.

    Michael

  26. Marmot says:

    Hi! The WP Admin bar might be a nice feature, but there’s no easy way to disable it, Thanks for explaining how to disable the WordPress admin bar to relax us in this regard.
    Marmot recently posted..Spring Sleeping BagsMy Profile

  27. John says:

    This is excellent, just what I was looking for. The code worked like a charm. Thanks so much!

  28. Xynchmaa says:

    What line of work are you in? jessica renee young 3167

  29. Mac says:

    Thank you for giving various options on disabling admin tool bar in WordPress. I would go for disabling it using plugins because programming is complicated for me.

    Thanks,
    Mac

  30. Annie from Graphic Designers Nashville
    Twitter:
    says:

    Nice! I think I’ll use check out one of the plug-ins.

  31. genesis user says:

    Hi,
    first of all, this hack is cool.
    My website use Genesis framework. but none of your code working. i already placed them in the functions.php of the child theme and genesis. none works :( please help i dont want to use plugin, thanks!

  32. Riza says:

    Great, its work on my blog, but how to remove this line :

    html { margin-top: 28px !important; }
    * html body { margin-top: 28px !important; }

    Thank you :)

  33. Paul says:

    Hi,
    I have tried every method listed to remove admin bar from my installations (WP 3.2.1 BP 1.5.1 Twenty Eleven (modified) theme) with no success.
    Is there something changed between WP 3.1 and 3.2.1?

  34. Also having problems in 3.3 — uncheck show toolbar, dump cache, and it’s still there. And apparently your brilliant software thinks my comment is too short, and is suggesting rather cheekily that I “say something useful.”

  35. raj kumar says:

    why would we remove this bar its very useful and it only appear to us not to our visitors

  36. Claverhouse says:

    I found the compulsory Toolbar so disgusting that I shall not continue with WordPress; whilst you are to be praised for offering so many solutions, eventually with progressive updates they will stop working, and people will be forced to stare at these vile bars squatting on their blogs, simply because devs want to make everything exactly how they want things.

    As an aside, most of these foul social networking diseases including Wibya, Twitter, slide-in bars, floating bars etc. can be blocked through one’s browser using AdBlockPlus, Ghostery, and Stylish, each with especial rules easily found on Google. Stylish even changed the black Google bar to white, making it less obstrusive.

  37. Joe Shaw
    Twitter:
    says:

    Just wanted to say thanks for this post. I could tell it was only on a per use basis but wanted to be sure. Thanks for the plugin and code tips also!

    :-)
    PS: I LOVE using commentluv!
    Joe Shaw recently posted..Want The Best WordPress Plugins for 2012?My Profile

Pinterest
WP Socializer Aakash Web
how to make money from blog