WordPress

How To Hide The Admin Bar In WordPress

The WordPress admin bar is a very handy and useful feature it allows you to easily edit front end content, or access certain plugins functions quickly. That being said it can also be an eyesore, it slows down the website and if you are only ever in the back end why do you want it enabled all the time?

There are a number of ways to remove the admin bar but the easiest is to simply add this code snippet to your functions.php file (of a child theme) or a site specific plugin so it won’t display on your front end anymore.

add_filter('show_admin_bar', '__return_false');

Now there are some cases where you don’t want to show it for your subscribers, and other logged in users but you as the administrator still want to be able to access it. The following snippet will only show it for admin users.

add_action('after_setup_theme', 'remove_admin_bar');

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

Now you can quickly and effectively disable the admin bar based for everyone or just the non-administrative staff on your WordPress website!

Tags
Show More

Scott Hartley

Scott Hartley is the developer and owner of The Daily Exposition who is also a tech enthusiast and writes the majority of content found on the website. When he isn’t keeping up to date with the latest and breaking technology news, he is working on his own WordPress plugins, themes, or out exploring the world.

Leave a Reply

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

Close