Falcon1986-Online

Home of a med student who likes to manage websites and talk tech!

Remove admin bar from WordPress 3.1

with 13 comments

WordPress LogoWordPress 3.1 was released last Tuesday and while it boasts a few new features, I did not want to have the Admin Bar. Now, the WordPress Admin Bar is great for quickly accessing frequently-used panels of your blog, but for a private website, I did not see much use in it. Disabling the Admin Bar is completely optional. Here I will explain how you can disable it on your own blog just by adding a few lines of code into your theme’s functions.php file.

You will only be able to implement this modification if you are using WordPress 3.1+. The Admin Bar is not present in versions 3.0.5 and below. Furthermore, the modification can only be applied to themes, so you will have to apply to new themes when they are added.

Locate the functions.php file within your theme’s subdirectory and open within a simple text editor. Append with the following code ensuring not to interfere with what is already present. Save and revisit your blog.

// Hide WordPress Admin Bar
add_filter( 'show_admin_bar', '__return_false' );

add_action( 'admin_print_scripts-profile.php', 'hide_admin_bar_prefs' );
function hide_admin_bar_prefs() { ?>
<style type="text/css">
	.show-admin-bar { display: none; }
</style>
<?php
}

The WordPress Admin Bar should now be absent both on your blog’s pages and within the dashboard. Awesome!

Advertisements

Written by falcon1986

27 February, 2011 at 12:09 AM

Posted in Wordpress

Tagged with

13 Responses

Subscribe to comments with RSS.

  1. Actually you can go to your user profile

    wp-admin/profile.php

    and uncheck the box to show the admin bar when viewing site. That will remove it when you browse your own site.

    John Hunter

    27 February, 2011 at 3:18 PM

    • Good point, John. However, this post was intended to demonstrate how to disable the admin bar altogether. Strangely, I don’t see the deactivation feature on my profile page.

      falcon1986

      28 February, 2011 at 8:11 PM

    • John, that removes it for your personal viewing, but doesn’t stop it getting displayed to other users viewing your site.

      Roger Coathup

      30 August, 2011 at 3:46 PM

  2. hm,.. that’s nice.
    but is there anyway to customize it instead of disabling it..

    like changining its logo or menu?

    thanks.

    status via

    28 February, 2011 at 1:50 AM

  3. The point of a CMS is to separate design, content, script, database. Why does Automattic keep mixing them up? I don’t want admin interfering with the front end design!

    Is there no line of script to completely block this thing? Buddypress – which sucks btw – had a similarly annoying ‘buddybar’. I used to have a ‘kill buddybar’ piece of code, but can’t find it.

    Peter Verkooijen

    5 March, 2011 at 2:27 PM

  4. Thanks for the info. Is there any possibility to downgrade your wordpress..Because I am planning to downgrade mine from WordPress 3.1 to WOrdpress 2.5 because I have a plugin which is not yet updated.

    Jhiegzh

    5 March, 2011 at 10:26 PM

    • From a security perspective, downgrading will revert your WordPress installation to a vulnerable state. There have been a lot of bug fixes since v2.5 and you would have to do some thorough “WordPress hardening” to avoid falling victim to an exploit. For this reason, it is recommended that you keep WordPress and your plugins updated.

      I understand that some plugins may fail to work on upgrades, but if the plugin author has not seen fit to update his/her plugin for compatibility since WordPress 2.5, I would not be so keen on trusting that plugin anymore. There are a lot of similar plugins out there; you just have to find one that is kept updated and offered support.

      Meanwhile, if you really want to roll back to an old version of WordPress, you can try following the Updating WordPress instructions, but replace with v2.5’s installation files instead. Please note that you should first create a complete backup of files and database(s) before attempting this downgrade, because you might run into trouble, especially when it comes to the upgrade script attempting to update the database. If anything goes wrong, you can fall back with your backup.

      falcon1986

      6 March, 2011 at 12:57 PM

  5. Thanks so much for this fix. Worked perfect. @John Hunter – uncheck box isn’t too viable when you have hundreds of members!

    Thanks again, great job. I give you a cookie.

    Ryan

    5 March, 2011 at 10:50 PM

  6. It only work for admin, not for user who have registered to mysite.

    zuhri

    14 March, 2011 at 12:09 AM

  7. Awesome issues here. I am very satisfied to peer your post. Thanks so much and I am looking forward to touch you. Will you please drop me a e-mail?

    click here

    27 August, 2012 at 7:45 PM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: