Answers for "wp hide admin bar"

1

wordpress make new users not be able to see top bar

add_action('after_setup_theme', 'remove_admin_bar');
 
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}
Posted by: Guest on November-08-2020
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
0

admin bar hide

/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );
Posted by: Guest on January-25-2021
0

admin bar hide wordpress

add_filter('show_admin_bar', '__return_false');
Posted by: Guest on May-05-2021

Browse Popular Code Answers by Language