How to disable WordPress Admin bar

How to disable WordPress Admin bar

WordPress automatically inserts the admin bar at the top of the page for logged in users. Well… I hate it as much as the grumpy cat does. If you feel the same, this is how you can disable it completely:

add_filter('show_admin_bar', '__return_false');

Or, you can show the admin bar just for certain user IDs, like this:

function wcr_hide_admin_bar() {
    $users = array(1, 4, 5); // users IDs

    if (is_user_logged_in() && !in_array(get_current_user_id(), $users)) {
        show_admin_bar(false);
    }
}
add_action('set_current_user', 'wcr_hide_admin_bar');
Leave a Reply

Get your fix of
all cool things WordPress

DigitalOcean hosting coupon 10$ coupon

for DigitalOcean hosting.
Sammy-approved.

Get this deal