Answers for "hide admin bar for subscribers"

1

hide wp admin bar for subscribers

/* 
* Add this to the bottom of your functions.php file to hide the wp admin
* bar for all users except those whom can edit posts.
*/

add_action('set_current_user', 'cc_hide_admin_bar');
function cc_hide_admin_bar() {
  if (!current_user_can('edit_posts')) {
    show_admin_bar(false);
  }
}
Posted by: Guest on September-14-2021

Code answers related to "hide admin bar for subscribers"

Browse Popular Code Answers by Language