Pawan Kumawat

How to Disable Admin Bar for All Users Except Site Admin

When we need to hide the admin bar for too much users of site excerpt admin, then changing each user’s settings manually would take a lot of time and effort.  and if we have more than 1000 users than it is very very difficult to change through admin panel setting.

Because of this reason we recommend disabling the admin bar by adding code to your functions.php

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

 

Share This On :

Leave a Comment

Your email address will not be published. Required fields are marked *

Categories
Scroll to Top

Request A Quote