How to Hide WordPress Tool Bar / Admin Bar

Posted by Lasantha Bandara File Under : wordpress 0 Comment

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');

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.