29 January 2017

How to Disable or Hide WordPress Admin Bar

Disable Admin Bar for All Users

If you want to disable it for all users, then simply put use this code in your theme’s functions.php file or your theme in wp-content.

  show_admin_bar(false);

you can also create this

  add_filter('show_admin_bar', '__return_false');

Disable Admin Bar for All Users Except for Administrators

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}


This code will stop the toolbar from displaying on the front-end of your site.

No comments:

Post a Comment