How to Disable WordPress Admin Bar for All Users Except Administrators

I am working on new public domain website where people can only able to vote after FB login. So i have done customized the easy facebook login plugin.

But then we are facing the issue that once user login with FB. He/She was getting Admin bar. So i have search for solution and below is step for same.

Just open function.php from our current theme and add below code

add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {

Disable Admin Bar for All Users

If you want to disable it for all users, then simply put use this code in your theme’s functions.php file

/* Disable WordPress Admin Bar for all users but admins. */

Leave a Reply

Your email address will not be published.