Select Page

By default, WordPress displays the Admin Bar for any user who signs in. This includes Subscribers, Editors, Authors, and any other custom user role you might add. If you want to display the admin bar only to the administrator users of your site, then you only need a small piece of code.

WordPress might also display the admin bar on eCommerce sites and Membership sites. If you don’t want to display it to anyone who isn’t an admin, then add this code to your theme’s functions.php file or create a custom plugin with this code:

if ( !current_user_can("administrator") )

The above code checks if the current user isn’t an admin. If the user isn’t an admin, then it calls the show_admin_bar function and disables the admin bar.

If you want to completely disable the admin bar for all users, then you simply call the show_admin_bar function with the false argument in your theme’s functions.php file:


The above code will disable the admin bar for all users whether or not they are admins.

If you simply want to hide the admin bar from all users, you can use this CSS code:

#wpadminbar {