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?".
This will probably slightly change as this component is heavily under works, but as of now this short plugin will do:
- <?php
- /*
- Plugin Name: No Admin Bar
- Plugin URI: http://planetozh.com/blog/2010/10/how-to-remove-wordpress-admin-bar/
- Description: Remove the Admin Bar
- Author: Ozh
- Version: 1.0
- Author URI: http://ozh.org/
- */
- // Remove instantiation
- add_filter( 'show_admin_bar', '__return_false' );
- ?>
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
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.
Useful thing Ozh.
Nacin it would be great UI option and much easier to manage admin bar.
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.
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.
This code is enough, since WP 3.0.0
add_filter( 'show_admin_bar', '__return_false' );
Best regards
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.
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.
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.