Support » Themes and Templates » Remove admin bar from dashboard?

  • Hello,
    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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 :-).

    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');



    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.

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

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

    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');


    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.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove admin bar from dashboard?’ is closed to new replies.