Remove admin bar from dashboard? (8 posts)

  1. casper1
    Posted 4 years ago #

    Is it possible to hide the Admin bar in the dashboard for the non-admin users? I know the CSS trick to display none, but I'm looking to remove this so that the code is not generated in the page.

  2. NuBlue-Hosting
    Posted 4 years ago #

    Hi Casper1,

    If you find the file


    Then go to line 344 and find the following code:

    <div id="wpadminbar" class="<?php echo $class; ?>" role="navigation">
    			<div class="quicklinks">
    				<?php foreach ( $root->children as $group ) {
    					$this->_render_group( $group );
    				} ?>

    The above is responsible for displaying the bar. Further to this if you use the is_super_admin() function you can limit the display to only super admins. Something like:

    if (is_super_admin())
    /* Dashboard Code Here  */

    Would show code only for the 1 super admin user (you'll need to play with it a bit as the admin bar html code has multiple php open and close tags in it but hopefully that gives a gist of how to do it. Hope that helps :-).

  3. Digital Raindrops
    Posted 4 years ago #

    Add to you themes functions.php

    /* Get rid of the admin bar for other users by capability */
    if ( is_user_logged_in() && !current_user_can( 'manage_options' ) ) {
         add_filter('show_admin_bar', '__return_false');


    /* Get rid of the admin bar for other non admin users */
    if ( is_user_logged_in() && !is_admin() ) {
         add_filter('show_admin_bar', '__return_false');



  4. Harrison Ortega
    Posted 4 years ago #

    Never change any WP core file unless you want to redo the work every time you update wordpress.

    There are many plugins available that will take care of that or just add the following code to your theme's function.php

    /* Disable the WordPress Admin Bar for all but admins. */
    if (!current_user_can('administrator')):

    By this way, only administrators will have the admin bar.

  5. NuBlue-Hosting
    Posted 4 years ago #

    Thanks Harrison O that is a much better way of handling it :)

  6. Dinesh Karki
    Posted 4 years ago #

    You can use this plugin as well. Activate it and you are done.


  7. Vavix
    Posted 4 years ago #

    I tried most of these things and plugins and nothing worked. I wanted to remove the admin bar since it is always fixed on top and sometimes causes visual bugs.

    The solution I found was to simply add your own css to functions.php and set the visibility to hidden like so:

    // hide admin bar
    function custom_admin_css() {
       echo '<style type="text/css">
               #wpadminbar {visibility:hidden}
    add_action('admin_head', 'custom_admin_css');
  8. Shane G.
    Posted 4 years ago #


    You can use the Adminimize plugin that lets you hide unnecessary items from the WordPress administration menu, submenu and even the 'Dashboard', with forwarding to the Manage-page.


Topic Closed

This topic has been closed to new replies.

About this Topic