• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Tips and Tricks » Disable the WordPress toolbar

Disable the WordPress toolbar

Chad Butler · Sep 4, 2012 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

The “admin bar” is actually more correctly referred to as the Toolbar. But most people refer to it as the admin bar, so I’ve referring to it as such in this post so as not to confuse anyone.

Removal can be managed with 3 lines of code to your functions.php file (or 1 if you really want to be efficient).

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 toolbar 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.)

/**
 * You can change the capability check for your specific need.
 * Limiting it to only users who can "manage_options" would
 * restrict it to only admins in a default WP install.
 */
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 from having the admin bar appear for them when they are logged in.


From https://butlerblog.com/2011/09/23/how-to-disable-the-wordpress-admin-bar/

Tips and Tricks admin-bar, free, show_admin_bar, tips, wp-filters

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy