How to Hide WordPress Tool Bar / Admin Bar

The WordPress Toolbar / Admin Bar (called it as Admin Bar before WP Version 3.3) contains links to information about WordPress, quick-links to create new posts, pages and links, and alerts to available updates to plugins and themes on your site and more. But sometimes user do not want to display this toolbar on the front-end of their websites. Note: It is no longer possible to hide the WP Toolbar when viewing the administration screens.
Each user can disable it going to their profile screen and unchecking the option "Show Toolbar when viewing site".
How To Disable WordPress Toolbar
http://YOUR_WEBSITE_URL/wp-admin/profile.php
But If you want to disable WordPress Toolbar for all users, then simply add this code in your theme's functions.php file:
add_filter('show_admin_bar', '__return_false');
To Disable toolbar for all users except your site administrators, add below code instead of above one:
if ( ! function_exists( 'disable_remove_tool_bar' ) ) :
function disable_remove_tool_bar() {
  if (!current_user_can('administrator') && !is_admin()) {
    add_filter('show_admin_bar', '__return_false');
  }
}
endif;
add_action('after_setup_theme', 'disable_remove_tool_bar');

Post a Comment

1 Comments