Site icon Hip-Hop Website Design and Development

Take away admin bar for subscribers

I’ve a membership web site. I must disable the admin bar for the subscribers.

I’ve used this code beneath:

add_action('after_setup_theme', 'remove_admin_bar');

perform remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}

which removes the admin bar from the frontend for the subscriber, however after they go to their profile web page wp-admin/profile.php, the admin bar remains to be displaying there.

I’m utilizing Paid Membership Professional plugin which I feel made the code not engaged on the backend for subscribers.

Additionally, I’ve used this code to take away the admin bar from in every single place:

if (!function_exists('disableAdminBar')) {

    perform disableAdminBar(){

    remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );

    perform remove_admin_bar_style_backend() {
      echo '<model>physique.admin-bar #wpcontent, physique.admin-bar #adminmenu { padding-top: 0px !necessary; }</model>';
    }

    add_filter('admin_head','remove_admin_bar_style_backend');

  }

}

add_filter('admin_head','remove_admin_bar_style_backend');

However this code can be not working.

I simply wish to take away the admin bar for the subscribers from each the frontend and backend pages.

Is there any particular code I’m lacking? I’m utilizing Paid membership Professional.

Thanks for serving to.