Show the WordPress Admin Bar for Administrators Only

Show the WordPress Admin Bar for Administrators Only

If you don’t want regular logged-in users of your site to see the admin bar, hiding it is very easy. This is especially useful for sites where users have to be logged in to comment but they don’t have much use for the dashboard.

Here’s a quick little trick I found at wp-snippets.com this week:

{code type=php}
if (!current_user_can(‘administrator’)) :
show_admin_bar(false);
endif;

Add it to your theme’s functions.php file or create your own little mini-plugin for it, if that’s what you prefer. After you add it, the admin bar will be hidden from all logged-in users except administrators.

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: