Show Admin Bar Only For Admins


When you are logged in your WordPress site, by default admin bar is added on top of all pages on both the frontend and backend. You can disable it on a per user basis in user’s profile settings. If you want to disable admin bar for everyone except the admins, add the following code in your theme’s functions.php file.

[php]
function disable_admin_bar() {
if ( ! current_user_can( ‘administrator’ ) && ! is_admin() ) {
show_admin_bar( false );
}
}
add_action( ‘init’, ‘disable_admin_bar’ );
[/php]
Reference:

You may also be interested in our other articles on add ‘hr’ button to editor, remove feeds form wordpress, allow more tags in comments and gravatar as favicon.


Comments

Leave a Reply

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