Hide Toolbar for Non-Admins

Found a handy function over at WP Beginner that allows you to hide the Toolbar for anyone that does not have Administrator access.

This was helpful for me recently working with a website that had multiple user types and registration points, and WooCommerce. Theme my login would hide the toolbar for the appropriate user types, and redirect the users back to the front end if they tried to access the admin area. However, WooCommerce would display the toolbar after users registered at checkout until they logged out, and reaccessed the site at another time. It was an interesting conflict.

add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {

	if (!current_user_can('administrator') && !is_admin()) {


Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.