How to insert the current user's role into the body class in the admin backend
I've tried updating this code from body_class
to admin_body_class
but it's not inserting the .role-author into the back end body class like it did with the front end body class... i'm guessing it's not as simple as replacing body_class
with admin_body_class
?
add_filter( 'admin_body_class', function( $classes )
{
if( is_user_logged_in() )
{
$classes = array_merge(
(array) $classes,
array_map(
function( $class )
{
return 'role-' . $class; // Here we prepend the 'role-' string
},
(array) wp_get_current_user()-roles
)
);
}
return $classes;
} );
Topic body-class user-roles css Wordpress
Category Web