How to remove admin bar from WordPress backend for the selected role?
Starting from version 4.21 User Role Editor allows you to create your own options for the roles and link the custom PHP code to them.
This feature realized via ure_role_additional_options filter.
Additional option ‘Hide admin bar’ included into User Role Editor by default works for the front-end only.
show_admin_bar() WordPress API, which is limited by logic realized at
is_admin_bar_showing() function from
wp-includes/admin-bar.php, which returns unconditional true for the admin backend:
// Integrated into the admin. if ( is_admin() ) return true;
So we have to use the additional tricks to exclude admin bar from back end for the selected role:
Just add the code above (without starting php tag) to your active theme functions.php and turn ON a new added ‘Remove admin bar from backend’ option for the selected role.