ButlerBlog

chad butler's weblog

  • About
  • Blog
  • WordPress Plugins
  • Contact
Home / Web / WordPress / How to disable the WordPress admin bar

How to disable the WordPress admin bar

By Chad Butler 19 Comments

Recently, I’ve received a number of comments and questions regarding the WP admin bar, so I thought it would be best to create a post that will give you some guidance as to how to turn this off for your subscribers. 

I know that some users of the WP-Members plugin have asked about adding an option to the plugin to turn it off. For the time being, that is not going to make it onto the project list. The reason for this is that adding additional options/settings requires a significant amount of overhead in terms of programming and also in considering the upgrade process. And for something as simple as the admin bar, which can be managed with 3 lines of code to your functions.php file (or 1 if you really want to be efficient), it’s just not worth it.

So how simple is it?

There is one filter that will turn off the entire admin bar:

add_filter( 'show_admin_bar', '__return_false' );

Adding that single line to your functions.php file (found in your theme folder) will turn off the admin bar for everyone (including you).

Suppose you want to use the admin bar for you (and other admins)?

If you would like to keep the admin bar for yourself, you just need to add a condition to test to see if the current user is an admin.  This example tests if the user has the capability to ‘manage_options’.  (If you have a role manager installed and have made changes to the default WP roles, adjust this accordingly.)

if ( ! current_user_can('manage_options') ) {
	add_filter( 'show_admin_bar', '__return_false' );
}

This can be used regardless of whether you are using the WP-Members plugin or not, but if you are using the plugin, this will prevent your subscribers for having the admin bar appear for them when they are logged in.

Enjoyed this article?

Don't miss a single post. Subscribe to our RSS feed!

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print
  • More
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Pinterest (Opens in new window) Pinterest

Filed Under: WordPress, WP-Members Tagged With: functions, plugins, tips, tutorials, webdev, WordPress, WP-Members

About Chad Butler

Chad Butler is a freelance writer and web developer. He has developed several popular WordPress plugins and has written for forbes.com, sfomag.com, and investopedia.com. He also runs a small organic farm in east Georgia.

Join Us!

I will never share your information. No spam. No junk. No kidding. Unsubscribe anytime.

Recent Posts:

  • The High Price of Free Plugins
  • YouTube Success: Key Tips for Enhancing Video Optimization and Visibility
  • Mobile App vs. Mobile Website Ideal Choice for your Business
  • Top Strategies to Boost Your Brand’s Visibility and Impact
  • Advanced Blogging Strategies: Using Analytics, A/B Testing, and Conversion Optimization Techniques to Grow Your Audience
  • Unlock Real-Time Process Insights to Save Time and Money
  • How Writers Can Attract More Audience Attention
  • Dress for Success – Even at Home
  • Mastering the Art of Crafting SMART Marketing Goals
  • Rediscover Your Brand Story: 7 Tips for Refreshing Your Company Identity

Archives

  • About
  • Blog
  • Archive
  • Contact

Site powered by WordPress, running on the Genesis Framework from StudioPress.

Unless otherwise noted, content on this site is © 2006-2025 ButlerBlog and may not be reproduced without express written permission from the author.

Some content may include affiliate links for which this site receives a small commission.