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

by | Jan 3, 2013

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.


Submit a Comment

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

Search Centered Digital Marketing - SEO Services

Did you learn something new?

Please leave a short review and a 5 ⭐ rating if you learned something from this article. It really means a lot to hear about what you've learned. Thanks!

»​​​​​​​ Review us now!

You have Successfully Subscribed!