Okay
  Print

Show / hide Admin bar base on user roles

Important

This article is outdated. Woffice has a new documentation here: 

https://alkaweb.atlassian.net/wiki/spaces/WOF/overview

If anything is missing, let us know and we will improve it. It was designed to be searchable, more organized and more complete. 

------



Please, add the following code in child theme's functions.php file.

function custom_remove_admin_bar() {
   if (current_user_can('subscriber')) {
        show_admin_bar(true);
   } else {
        show_admin_bar(false);
   }
}
add_action( 'after_setup_theme', 'custom_remove_admin_bar', 30);

The above code show admin bar if the user has the "subscriber" role . You may change "subscriber" with any other capability to show bar for that capability :)