The Admin Bar you all know on WordPress installations is not always a feature that you might want to provide access to.
Here we will show you how to hide this bar for users, how to hide it for all users and how to keep the bar on for Admins.
Disable 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);
}
}
Disable Admin Bar for All Users
/* Disable WordPress Admin Bar for all users but admins. */
show_admin_bar(false);