How to Disable WordPress Admin Bar for All Users Except Administrators

Add the following code to the function.php in the theme file

				
					add_action('after_setup_theme', 'remove_admin_bar_all_user');
function remove_admin_bar_all_user()
{
    if (!current_user_can('administrator') && !is_admin()) {
        show_admin_bar(false);
    }
}
				
			

Drop your queries

Table of Contents

Have A Project In Mind? Let's Get To Work