WordPress Admin Nav Showing in Frontend

Anyone know how to remove the admin navigation links from the frontend? I’ve built a custom theme and when I am logged in to WordPress, WordPress is appending the admin nav bar somewhere.

Related posts

Leave a Reply

6 comments

  1. Or you can remove it by default in functions.php.

    /* Disable the Admin Bar. */
    add_filter( 'show_admin_bar', '__return_false' );
    
    <?php function yoast_hide_admin_bar_settings() { ?>
    <style type="text/css">
        .show-admin-bar {
            display: none;
        }
    </style>
    <?php }
    
    function yoast_disable_admin_bar() {
    add_filter( 'show_admin_bar', '__return_false' );
    add_action( 'admin_print_scripts-profile.php',
         'yoast_hide_admin_bar_settings' );
    }
    add_action( 'init', 'yoast_disable_admin_bar' , 9 );
    

    Thanks to Yoast (http://yoast.com/disable-wp-admin-bar/)

  2. For wordpress 3.4.2, none of these workarounds should work. I have sorted out a very simple trick to hide the admin bar!

    Just after you call the wp_head(), place this style declaration:

    <style>
        html { margin-top: 0px !important; }
        * html body { margin-top: 0px !important; }
    </style>
    

    It involves no modification to the functions or whatever. Just plain old css!!
    I hope it solves the Googler’s problem in near future 🙂

  3. Put this in your functions.php:

    /* Disable WordPress Admin Bar for all users but admins. */
    if(!current_user_can("manage_options")){
         show_admin_bar(false);
    }