How to hide WordPress admin bar

How to hide WordPress admin bar

WordPress admin bar is a toolbar shown at the top. When we already logged in at WordPress backend and browse the frontend then it will appear at the top. This tool bar provides various helpful options which allow us to go directly at admin area and manage required things easily. For example we are viewing any page on frontend and we need to edit the page then with the help of tool bar we can do it very quickly by just clicking on “Edit Page” link instead of going to backend – page list and then edit the page.

But sometimes we need to get rid of it when it comes in our way. Specially when we are working on design, or we need to see a quick preview that how the page is looking without that toolbar. In this case we need to hide WordPress admin bar.

It can be super easy with single WordPress site by just checking/unchecking a checkbox. But what if multisite WordPress installed then that check-box will hide WordPress admin bar for all the sites and we just need to hide WordPress admin bar on the site we are working on. In this case we need to add some functions which enables us to hide WordPress admin bar for current site only.

Folllowing are few ways which allow hiding admin bar based on requirements. We need to place this hooks in functions.php file.

Hide WordPress admin bar for some sites on multi-site network

1. For one site

add_action('after_setup_theme','remove_admin_bar_for_one_site' );
function remove_admin_bar_for_one_site() {

   // the global variable
   global $blog_id;

   // remove admin bar for any one site
   if ($blog_id == 1){

2. For multiple site

add_action('after_setup_theme','remove_admin_bar_for_multiple_site' );
function remove_admin_bar_for_multiple_site() {

   // the global variable
   global $blog_id;

   // remove the admin bar from multiple sites
   if (in_array($blog_id, array(1,2,4,5,10,15))){

Hide WordPress admin bar for one page only

// hide the admin bar for home page
add_action('after_setup_theme', 'remove_admin_bar_for_homepage');
function remove_admin_bar_for_homepage() {

   if (is_home()){

// hide the admin bar for any other page
add_action('after_setup_theme', 'remove_admin_bar_for_a_page');
function remove_admin_bar_for_a_page() {

   if (is_page('About Us')){

Hide WordPress admin bar based on user access rights

add_action('after_setup_theme', 'remove_admin_bar_userwise');
function remove_admin_bar_userwise() {

   // check for permissions and hide admin bar
   if (!current_user_can('read')){
      show_admin_bar( false );

Always hide WordPress admin bar

add_action('after_setup_theme', 'remove_admin_bar_always' );
function remove_admin_bar_always() {

You can also add filter to hide WordPress admin bar

add_filter('show_admin_bar', '__return_false');

There’s obviously a wide variety of scenarios for when and where to hide your admin bar, but hopefully the following examples will give you a good groundwork. This code will, most likely, go in your functions.php file.

Above code segments are few scenarios to hide WordPress admin bar. Examples shown above can be really helpful. If you’ve any suggestions/comments then please add your comments or reach me from here

Useful resources:

Speak Your Mind


I’ve worked with Ashish for a couple years now and have enjoyed consistently great results. He’s easy to work with, attentive and reliable. He brings a diverse set of web development skills to the table and has excelled at every project we’ve engaged him on. I highly recommend him.

Ash is awesome to work with, he makes sure he understands the project and delivers beyond expected work with precision on time delivery. Ash and his team is great to work with and I highly recommend them. Working with Ash you dont have to worry about the final product cause they also do QA before its delivered to your server. Great JOB Ash being great working with you.

Ashish is a good resource for our team. We have been working with him for the past 5 years and delivers work on time. He’s always ready to go an extra mile to please our clients. Hope to continue working together!

Ashish is a professional who meets the agreed schedule. He is always well disposed to help. Is a very kind person. He is a professional with excellent technical level.

I have been looking for a great developer for a while now, and I was very happy to find Ashish. He does great work, and meets deadlines on a consistent basis. He requires very little oversight, as everything is typically done 100% correct the first time. I absolutely recommend Ashish as a developer.

Ashish and his team did a wonderful job on our company website. The project was reasonably priced, he finished it on time, and it is just as functional as it is beautiful. Our website is an essential part of our business, and we get compliments on it all the time. I would highly recommend Ashish for website development.

Ashish and his team were creative, responsive, and worked within our budget to create a fantastic looking website that has all the functionality we wanted. He is so talented, we feel lucky to have found him. I HIGHLY recommend him to anyone looking for a website developer.

Ashish does all my web stuff. Fast and does a brilliant job. Thanks Ashish, great work.

Ashish is an amazing programmer. He is quick to help and very knowledgeable. I feel confident taking almost any issue to him and he is able to work through it. Very friendly and professional.

Ashish is very thorough and we really like working with him. He will be a great asset to any organization.

Free and best WP plugin to analyze your site with the help of charts.
WP Show Stats plugin

+91 9033402074

Freelancer Coder
238, Back Bone Shopping Center,
Chandresh Nagar Main Road,
Mayani Chowk, Rajkot - 360004,
Gujarat, India