Hide Admin Bar for Specific User Roles

Hide the admin bar for specific user roles.

<?php
function hide_admin_bar_for_roles() {
    if (current_user_can('editor') || current_user_can('author')) {
        show_admin_bar(false);
    }
}
add_action('wp_loaded', 'hide_admin_bar_for_roles');

Post Comment