Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Maybe this is a stupid question.

When a user logins to my Wordpress site with the Subscriber role, they have the WP Admin Bar appearing at the top of the page. The user can go into their dashboard and turn this off themselves. But how can I turn this off by default for all existing and new users?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted
function disable_admin_bar_for_subscribers(){
    if ( is_user_logged_in() ):
        global $current_user;
        if( !empty( $current_user->caps['subscriber'] ) ):
            add_filter('show_admin_bar', '__return_false');
        endif;
    endif;
}
add_action('init', 'disable_admin_bar_for_subscribers', 9);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.