WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Cannot remove admin bar from wp-admin in 3.3 (26 posts)

  1. Dunhamzzz
    Member
    Posted 2 years ago #

    I'm on the latest trunk, and for some reason it is impossible to remove the admin bar in both the conventional and unrecommended ways, I have tried all of these so far:

    add_filter( 'show_admin_bar', '__return_false' );
    show_admin_bar(false);
    remove_action('init', 'wp_admin_bar_init');

    I understand that some of the admin functionality is being merged into the adminbar, but as I am doing a complete wp-admin re-skin I don't need the screen options/help etc that is now in the admin bar anyway.

    Will there be a way in the future to remove the adminbar properly in the wp-admin in 3.3? Obviously CSS is still a possibility.

  2. Probably just CSS, at least for the back end. You can still turn it off via a checkbox for the front.

    This will kill it: #wpadminbar { display:none; }

  3. Dunhamzzz
    Member
    Posted 2 years ago #

    Yeah obviously but it's still loading it and including the JS/CSS unnecessarily. Need a little bit more CSS to remove the padding from #wpwrap as well:

    body.admin-bar #wpcontent, body.admin-bar #adminmenu {
    	padding-top: 0;
    }
  4. Honestly, I'd design your custom admin theme around it, but only because it's the "way WP is headed." The more you have to rip out, the more of a hassle it becomes to maintain your admin theme/plugin.

  5. Dion Hulse
    WordPress Dev
    Posted 2 years ago #

    Just to echo Ipstenu here, You're going to be better off including it in your design somehow, even if it's a static bar at the top of the screen (rather than being fixed).

    Most of the 3.2 header has now been moved into the admin bar, removing it will remove functionality.

  6. nv1962
    Member
    Posted 2 years ago #

    No idea what makes the WP core dev team like the bar. The functionality that is in the admin bar is and has always been in the vertical so I don't care for its silly duplication. It's really a pity that the bad idea of adding more clutter is so incredibly persistent, without an option to switch it off. Seriously: the recommendation is to use CSS with display:none?

    The WP core team should have thought longer about insisting in propping up that dagnabbed horizontal clutter, or at least include a general off switch (for all users, not the ridiculous per-user of 3.1 and 3.2).

    I hope some smart developer comes up with a plugin to get rid of that annoyance, soon.

  7. gilgimech
    Member
    Posted 2 years ago #

    Try putting this in you functions.php file.

    if (!function_exists('disableAdminBar')) {
    
    	function disableAdminBar(){
    
      	remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
    
        function remove_admin_bar_style_backend() {
          echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
        }
    
        add_filter('admin_head','remove_admin_bar_style_backend');
    
      }
    
    }
    
    add_filter('admin_head','remove_admin_bar_style_backend');
  8. Rainvur Jefferson Wilbre
    Member
    Posted 2 years ago #

    dang is that adminbar persistent!

    Tried your code 'gilgimech' and that did not work in my case, still thanks for the efforts, and may work for others anyhow.

    If this has been truly [resolved], could someone mention what has worked for them? Hopefully more than just CSS removal technique?

  9. gilgimech
    Member
    Posted 2 years ago #

    Oh wait, sorry I just noticed that the code was right there. try this.

    if (!function_exists('disableAdminBar')) {
    
    	function disableAdminBar() { // begin disableAdminBar function
    
    		remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
    
    		function remove_admin_bar_style_backend() {
    			echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
    		}
    
    		add_filter('admin_head','remove_admin_bar_style_backend');
    
    	}  
    
    }
    
    add_action('init','disableAdminBar');

    But the real problem is that the admin bar is also the header now, so if you remove it'll remove the login stuff in the right corner. I'm working on a way to restore the header to the way it was in vs 3.2. I don't like the admin bar either, but I'm going to live with it for now.

  10. Rainvur Jefferson Wilbre
    Member
    Posted 2 years ago #

    This plugin from 'sLa' works on 3.3 now, quick fix! ...

    http://downloads.wordpress.org/plugin/wp-admin-bar-removal.zip

  11. olyma
    Member
    Posted 2 years ago #

    If you wish to completely disable the admin bar in the Dashboard and have 3.3 work --- yes, you can use sLa's Admin Bar Removal plugin:

    http://wordpress.org/extend/plugins/wp-admin-bar-removal/

    but to restore logout functionality, use it in conjunction with my plugin One Click Logout Barless:

    http://wordpress.org/extend/plugins/one-click-logout-barless/

    Installing both plugins together in 3.3, they get rid of the admin bar AND allow logout, and when multisite is installed -- my plugin allows multisite navigation, too.

    Cheers!

  12. Marcin Modestowicz
    Member
    Posted 2 years ago #

    To remove WordPress 3.3 admin bar but left user and front end links intact (so restore the header to the 3.2 version) without plugin, you should put this into your functions.php or custom plugin:

    function remove_admin_bar_links() {
    	global $wp_admin_bar;
    	$wp_admin_bar->remove_menu('wp-logo');
    	$wp_admin_bar->remove_menu('view-site');
    	$wp_admin_bar->remove_menu('new-content');
    	$wp_admin_bar->remove_menu('comments');
    }
    add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );

    and add stylesheet with these lines to your admin_head:

    #wpadminbar {left:146px;background-color:#fff; background-image:none;z-index:9;border-bottom: 1px solid #ccc;
    -moz-box-shadow: 0px 2px 2px rgba(50, 50, 50, .1);
    -webkit-box-shadow: 0px 2px 2px rgba(50, 50, 50, .1);
    -box-shadow: 0px 2px 2px rgba(50, 50, 50, .1);}
    #wpadminbar .ab-top-secondary {margin-right:146px;background-color:#fff; background-image:none;}
    .folded #wpadminbar .ab-top-secondary {margin-right:32px;}
    body.admin-bar #adminmenu {padding-top:0px;}
    #wpadminbar * {text-shadow: none; color: #444;}
    #wpadminbar .ab-top-menu > li:hover > .ab-item, #wpadminbar .ab-top-menu > li.hover > .ab-item, #wpadminbar .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus {background-color:#fff; background-image:none; color: #444; text-decoration: underline;}
    #wpadminbar .quicklinks .ab-top-secondary > li, #wpadminbar .quicklinks .ab-top-secondary > li a {border:0;}
    #wpadminbar .menupop .ab-sub-wrapper, #wpadminbar .shortlink-input {
    -moz-box-shadow: -2px 2px 2px rgba(50, 50, 50, .1);
    -webkit-box-shadow: -2px 2px 2px rgba(50, 50, 50, .1);
    -box-shadow: -2px 2px 2px rgba(50, 50, 50, .1);
    border-color: #ccc;}
    #wpadminbar .quicklinks a {padding: 0 15px;}

    Works like a charm for me.

  13. budestrings
    Member
    Posted 2 years ago #

    Marcin Modestowicz - could i please have some more detail on how to apply your above fixes - i have problems with an unstyled admin bar appearing to non logged in users, which looks a mess: http://www.budestrings.co.uk. also when i am logged in the 3.3 admin bar is broken and menu items float around underneath the bar. i've tried a whole bunch of suggested fixes, with no luck so far, so i'd be happy just to turn off the admin bar for now.

    many thanks in advance.

    cheers, jan

  14. Marcin Modestowicz
    Member
    Posted 2 years ago #

    Hello Jan

    You are using WordPress Admin Bar Improved plugin but it seems that stylesheet and script files for that plugin are missing. If you use firebug or similar tool you will see that server response for these assets is 404 (Not found). That's why your admin bar is broken. There's probably something wrong with your WordPress configuration or simply those files are not there. Try to uninstall or reinstall the plugin.

    If you want to use my solution, disable plugin mentioned above and simply put first piece of code into your functions.php file. You will find it in wp-content/themes/the_world_is_listening_ote049/ folder or under Appearance -> Editor in your WP admin panel. Then you should add complementary stylesheet to your WP admin panel header. You should do this by writing a plugin, but if you're not very familiar with this, take a shortcut and just put the code to your functions.php file:

    function my_admin_head() {
        echo '<link rel="stylesheet" type="text/css" href="' .get_stylesheet_directory_uri().'/admin.css">';
    }
    add_action('admin_head', 'my_admin_head');

    Then create the file admin.css, paste the CSS code into it and upload to the wp-content/themes/the_world_is_listening_ote049/ folder on your server.

    Hope it helps

    Marcin

  15. budestrings
    Member
    Posted 2 years ago #

    hi marcin.

    thanks for the prompt reply. excuse my muppetry - not sure i'm getting this right. i've placed the top two lines of code in functions.php - does it matter where? i've put it on line 412. also by first piece of code, do you mean ending with the }?

    i've also created and put up the admin.css file - exactly what part of the code should it contain?

    i'm still seeing the unstyled yellow menu on the left when logged out and the floating menu items when logged in.

    thanks for your patience..

    cheers, jan

  16. gilgimech
    Member
    Posted 2 years ago #

  17. Virtual Clover
    Member
    Posted 2 years ago #

    Woo...thanks so much olyma for those plugin links. I hate that stupid admin bar and half the plugins I use with an offsite login option from the dashboard were rendered useless by the admin bar copying and cloning itself down the page blocking buttons, links and text fields...like a string of admin bars...god I hated that thing but those two plugins got rid of it on both the back and front end...thank you so much!

    I know some of you Wordie fanboys love everything the WP Devs throw at you - and I'm a Wordie fan girl myself - but seriously, some of these things are intrusive, annoying and should always have a user option to turn it off. I like the simplicity of the 2010 and 2011 default themes but I'll never, ever use them. The one single time I did, I had to go back in and redo the styles and other settings every time WP sent out an upgrade. The devs might think that's necessary but those of us who spend time styling things get really ticked really quickly having to redo all that. We shouldn't have to save copies to replace anything short of a backup for a crash...

    Anyway, I know it won't make a dent so whatever. At least I got rid of that stupid admin bar. If it's as simple as a couple plugins to do the trick, I really can't see why the devs force it on people and can't "dev" up an OFF switch. It's obviously not that hard to pull off...

    Happy New Year to you guys, by the way...stay safe!

  18. Marcin Modestowicz
    Member
    Posted 2 years ago #

    Hello Jan

    You can put the first piece of code anywhere in your functions.php file, before the ending PHP tag (?>) - it should work just fine. Admin.css file should contain the CSS code - second part of code in my first reply, beginning with "#wpadminbar...".

    Nevertheless, to get rid of those unstyled menus on your frontpage you should first disable WordPress Admin Bar Improved plugin - it probably has its own admin menu rendering system, which won't be affected by my custom changes.

    Regards

    Marcin

  19. nv1962
    Member
    Posted 2 years ago #

    Thanks Olyma! Finally got rid of that clutter-magnetic strip. Which suspiciously looks like a copycat of Google's and Twitter's and... and... As I strongly suspected, plugin developers can't help themselves and hungrily jumped on that admin bar like white on rice, and the poor thing predictably grew exponentially over these past weeks with "handy" (and repetitive) plugin shortcuts.

    No more. Pity that it takes two plugins to correct the problem in the core but there you are. I'm happy again (until the next "must-have-like-the-others" appears).

  20. thelaw
    Member
    Posted 2 years ago #

    When I try to add the code to remove the bar from functions.php, I get:

    "Call to undefined function add_filter()"

    add_filter('show_admin_bar', '__return_false');

    Same issue - call to undefined function in wp-includes/functions.php.

    This is a disastrous idea. Users can now see so many things in the bar that I cannot allow them see. Providing no way to turn this off is mind boggling. We'll see how more unnecessary plugins will clog the system and shouldn't need be there. Hopefully this will be "fixed" soon.

    Old Skool Plugin - only removes the admin side toolbar, not what the user sees on the front end. I need the opposite and fast.

  21. budestrings
    Member
    Posted 2 years ago #

    i did manage to (sort of) cure my issues. my problem was mainly with an unstyled admin bar menu floating around behind my page header at the top left. i saw mention in another thread of looking out for link code which might have been erroneously copied into the footer - sure enough when i looked at footer.php i saw the link code relating to my unstyled menu. i unceremoniously ripped out the offending code from footer.php, which not only removed my horrid unstyled menu but appears to have completely annihilated the front end admin bar, which is no longer visible. i still have an admin bar when i am logged into the dashboard which i now get to via the 'log out' link in the footer: http://www.budestrings.co.uk

  22. thelaw
    Member
    Posted 2 years ago #

    Thanks - I had to get rid of the whole thing. While I liked having the admin bar on the back end, I could not have it on the front end.

    Add on any line: add_filter( 'show_admin_bar', '__return_false' );

    Put that in your theme/functions.php file and it will get rid of it entirely. Just had to be done. Thanks for your help.

  23. budestrings
    Member
    Posted 2 years ago #

    i did try that filter on mine to no avail. i reckon the code in the them i am using is a mess - maybe a lot of this stuff will become redundant when i have my site functionalities sorted and migrate to a premium theme... a man can dram can't he?

  24. shibulijack
    Member
    Posted 2 years ago #

    Just install this simple plugin: CJ Remove WP Toolbar
    Tested up to 3.3.1

  25. fogger
    Member
    Posted 2 years ago #

    I Would like to thank Marcin for the nice code it works well and opens some cool style possibilities too..the real issue for was was just to get the links out of the way..the drop down seemed to always get in the way when flying thru the process of create a page check the live view ect..So THANKS Marcin! You Rule!
    :)

  26. dains
    Member
    Posted 2 years ago #

    Thanks @thelaw, your fix worked for me. To the devs, I don't understand the need for any "admin bar" at all. Do we not live in a world of tabbed browsers, where anyone can simply drag the Site Admin link to a new tab and use the full interface from there? While popping back to the site view tab and refreshing it to see the changes in real time?
    My reasons for removing it are simple. a) I have testing to do, and having the admin bar showing up on the front end regardless of the user's profile setting puts a variable into testing that I can't measure. b) my users are not site admins, and they have no wish or reason to learn how the WP back end works in any fashion, they just want to post their comments and posts using conveniently placed front-end controls, like the ones they use on other freely available, large scale systems.
    Given that, I would suggest that the time and effort to make yet another admin interface would be better spent on bringing WordPress up to the times with WYSIWYG front-end posting, editing and profile management. I'd offer my solutions but they're basic bubble gum and bailing wire arrangements to keep my users thinking that WP lives in the year 2012, and not anything that could be used to bring the capabilities to core.

Topic Closed

This topic has been closed to new replies.

About this Topic