In: , ,
On: 2010 / 10 / 04
Shorter URL for this post: http://ozh.in/tx

It will be a matter of personal preference or a matter of clients asking for it, but I bet this one is going to be a frequent question in the next months: "How do I remove the Admin Bar?".

Ahah. I'm so funny.

This will probably slightly change as this component is heavily under works, but as of now this short plugin will do:

  1. <?php
  2. /*
  3. Plugin Name: No Admin Bar
  4. Plugin URI: http://planetozh.com/blog/2010/10/how-to-remove-wordpress-admin-bar/
  5. Description: Remove the Admin Bar
  6. Author: Ozh
  7. Version: 1.0
  8. Author URI: http://ozh.org/
  9. */
  10.  
  11. // Remove instantiation
  12. add_filter( 'show_admin_bar', '__return_false' );
  13.  
  14. ?>

Either make this a regular plugin in wp-content/plugins/ and activate it, or just drop it in wp-content/mu-plugins/.

Update: now a downloadable plugin.

Update 2: this was a sort of a proof of concept. Now that WordPress 3.1 is released and has a per-user option to disable it, this plugin is incomplete: if you want to disable the admin bar, also hide the option as Pete Mall explains.

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/tx

Metastuff

This entry "How To Remove WordPress’ Admin Bar" was posted on 04/10/2010 at 10:36 pm and is tagged with , ,
Watch this discussion : Comments RSS 2.0.

8 Blablas

  1. Andrew Nacin says:

    We'll probably reduce this to a single filter. Additionally, we're still going to discuss a UI option.

    As I pointed out here, it's best not to rely on the state of something in trunk until well after feature freeze or until there have been some real iterations.

  2. Mamaduka says:

    Useful thing Ozh.

    Nacin it would be great UI option and much easier to manage admin bar.

  3. Frank says:

    Your plugin remove only the css and the init. What is with the scripts (wp_admin_bar_js) and the redering? I think, the admin-bar is current an alpha-version, i hope it give an option or one hook for frontend and one for backend zo include all functions.

  4. Stephanie says:

    I just installed the 3.1beta1 and the very first question on my mind was 'how do I get rid of this admin bar?!'

    Thanks for posting the answer. I've added the remove_action to my theme functions, works like a charm.

    They really really should make this an option in Settings, and default it to "off". It is very uncool to add stuff to the live side of a site without asking. Even if it is something only seen by logged-on admins, it is just a bad idea to surprise people with unexpected 'additions' to their site.

  5. Frank says:

    This code is enough, since WP 3.0.0
    add_filter( 'show_admin_bar', '__return_false' );

    Best regards

  6. Wes says:

    Thanks for the info, it helped me and I then wrote a plugin to help give people more control without much work: WP Custom Admin Bar

    You can control who can see the admin bar by user role and disable it for a single browsing session or on a single page.

  7. David says:

    Thank you so much, am going to naturally add "add_filter( 'show_admin_bar', '__return_false' );"

    to all of my themes now… the admin bar is so damn annoying, its features like the admin bar that should be left kept as a Plugin, and not a part of wordpress, I am sure other developers agree.

  8. Agreed with David – the hamfisted behavior of certain WP core developers in the manner they add unnecessary and arbitrary bloatware to WP are a wonderful way to drive people off to a competing CMS.

    Then again, fortunately there are great people also like Ozh jumping in to mitigate the damage of their bone-headed peers. Thanks for the fix, Ozh; what pity you had to spend time on fixing a WP design flaw.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.

Read more ?