Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › How to display admin bar for some user role › Reply To: How to display admin bar for some user role
09/08/2015 at 09:27
#1637
Vladimir
Keymaster
Try this variant:
add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
function _wc_disable_admin_bar($prevent_admin_access) {
if ( !( current_user_can('data_entry') ||
current_user_can('operator') ||
current_user_can('manager') ) ) {
return $prevent_admin_access;
}
return false;
}
add_filter('woocommerce_prevent_admin_access', '_wc_prevent_admin_access', 10, 1);
function _wc_prevent_admin_access($prevent_admin_access) {
if ( !( current_user_can('data_entry') ||
current_user_can('operator') ||
current_user_can('manager') ) ) {
return $prevent_admin_access;
}
return false;
}