Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Create new Role – no dashboard access › Reply To: Create new Role – no dashboard access
03/01/2018 at 03:13
#4535
Vladimir
Keymaster
Hi Chris,
Be aware that editing plugins source files is not a good practice. All changes will be lost after the next plugin update. And you will have to make the same changes again.
The better solution is to edit your child theme functions.php file only:
add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
function _wc_disable_admin_bar($prevent_admin_access) {
if (!current_user_can('see_admin_toolbar')) {
return $prevent_admin_access;
}
return false;
}