Showing posts with label How to Disable WordPress Admin Bar for All Users Except Administrators. Show all posts
Showing posts with label How to Disable WordPress Admin Bar for All Users Except Administrators. Show all posts

Saturday, August 18, 2018

How to Disable WordPress Admin Bar for All Users Except Administrators

Disable Admin Bar for All Users Except for Administrators

Paste this code in your theme’s functions.php file
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

If you want to disable it for all users, then simply put use this code in your theme’s functions.php file
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
  show_admin_bar(false);
}