X

Only Show Admin Bar to Administrators

Snippets by IsItWP

Admin bar may be unnecessary for the membership sites, eCommerce stores or any other website that offers user registration to the general public. It should be limited to website administrators only.

Instructions: Add the following code to the functions.php file of your WordPress theme to only show admin bar to administrators of the website.

<?php

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

?>

You may also enjoy removing the WordPress logo from the admin bar.

[code][/code]

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!