wordpress hide admin bar code example

Example 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);
}
}

Example 2: remove admin bar wordpress front end

/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );

Example 3: admin bar hide wordpress

add_filter('show_admin_bar', '__return_false');

Tags:

Misc Example