Show Admin bar in wordpress only if user is logged in

Posted by
December 24, 2018

You can determine if the user is logged in then only the admin bar is shown. For example, the following lines will only display the admin bar for logged in users.

Here is the simple snippet will do a trick. Add this code to your theme functions.php file

function blog_7v_admin_bar() {
    if (!is_user_logged_in()) {
        return false;
    } else {
        return true;
    }
}
add_filter('show_admin_bar', 'blog_7v_admin_bar');

 

read more