How to only show the admin toolbar for administrators in a WordPress website

WordPress Admin Bar

Do you not need that handy-dandy toolbar at the top of your WordPress website for any user who is not an administrator?

Here’s a little snippet of code you can add to your theme’s functions.php file.

This snippet of code will simply hide the WordPress toolbar from any user who is not an administrator. This means it will be hidden for editors, authors, contributors, subscribers and guests (non-logged in) users.

Show WordPress Toolbar for Administrators Only

if (!current_user_can('administrator')) :


Code snippet originally from Only show admin bar to administrators on

As you may have guessed, you can replace administrator with editor to have the toolbar only show up for editors, author for only authors, etc.

Show the WordPress Toolbar for Author Role and Higher

Of course, it is likely you want to show the toolbar for everyone with an author role or higher. To do this, replace administrator with publish_posts This is because everyone who is an author or higher has the ability to publish their own posts. The difference, a contributor cannot publish posts. They must submit a post for approval to be published by an editor or an administrator

To display the toolbar for each role and above, use the following

  • guest – get the plugin WordPress Admin Bar Improved. Activating the toolbar for guests really doesn’t do any good unless you add some functionality to it. WordPress Admin Bar Improved allows you to add a simple Ajax login form to the toolbar (and other options), so visitors can login without reloading the page. NOTE: The WordPress Admin Bar Improved will override any of the other user role settings.
  • subscriber – do not add a code at all to your functions.php
  • contributor – use edit_posts instead of administrator
  • author – use publish_posts instead of administrator
  • editor - use edit_others_posts instead of administrator
  • administrator – use administrator, alternatively, you can use activate_plugins  

Want us to add this modification for you?

Send us an email and we can make the toolbar modification on your website very cheap.

  • Indie Extras | Kansas City web design
  • Eat It Kansas City | Kansas City web design
  • The Woods Within | Indie Horror Slasher Movie
  • Social Security On Call
  • WP Caretaker | WordPress Maintenance Services
  • Dave's Shutter and Blind | Kansas City Plantation Shutters
  • Leonard Jackson | Political and Financial Blogger
  • Blogger Local | Kansas City Web Design
  • WinPro Solutions | Kansas City Web Design
  • Pinnacle Jewelry Buyers - Kansas City
  • DG Busy Bee Cleaning | Kansas City Web Design Portfolio
  • Aine Wendler Piano Studio | Kansas City Web Design Portfolio
  • KD Reports | Video and text search engine optimized content creation for websites
  • Best Twitter Tools to get more Twitter Followers
  • Alpha Pawn Shops are Kansas City's premier pawn shops
  • The Campground, A Roman Jossart slasher
  • Peculiar Film Festival
  • DVM 1 Source
  • KC AutoGlass Website Screnshot
  • doughofthedead
  • dough_boys_pizza
  • Joe's Datacenter
  • Caitlin Ogren Photography
  • Elegant Design Events
  • Commish Advisor