Remove the admin bar from the front-end of WordPress

This little snippet removes the admin bar permanently from all users while logged in and viewing the website from the front-end. Personally, I never use it and always turn it off with this little snippet.

// Remove the admin bar from the front end permanently
add_filter( 'show_admin_bar', '__return_false' );

Useful post? Share it

2 comments on “Remove the admin bar from the front-end of WordPress

  1. Great snippet. However, some users just want to disable the Admin Bar for all users except for Administrators.

    add_action(‘after_setup_theme’, ‘remove_admin_bar’);
    function remove_admin_bar() {
    if (!current_user_can(‘administrator’) && !is_admin()) {
    show_admin_bar(false);
    }
    }

  2. As an addition to my previous comment, you can also remove the Admin Bar preference in user profile to remove temptation…

    remove_action( ‘personal_options’, ‘_admin_bar_preferences’ );

Leave a Reply

Your email address will not be published.