X

Only Show Admin Bar to Administrators

Do you want to hide the admin bar for registered users? Admin bar may be unnecessary for the membership sites, eCommerce stores or any other website that offers user registration to the general public. You can add the following code to the functions.php file of your WordPress theme to only show admin bar to administrators of the site.

<?php

// Snippet code goes here!
if (!current_user_can('administrator')) :
  show_admin_bar(false);
endif;

?>

We hope this code helped you show admin bar to administrators only. You may also want to check out our guide on remove the WordPress logo from the admin bar.

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!