Hide Admin Bar For Non-Admin Users

I recently had a site where the client wanted to have the resellers register for access to specific pages, but we didn’t want those users to see the admin bar displayed on the front end of the site once they logged in using wordpress user accounts.  The following code will disable that admin bar for all users that do not have administrator capabilities.

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

reference: http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/

Scroll to Top