I have this function to add the current user role as a class in the body.
add_filter( 'body_class', 'custom_class' );
function custom_class( $classes ) {
$classes[] = get_user_role();
return $classes;
}
It doesn't work and I know that the problem is get_user_role() in this line:
$classes[] = get_user_role();
What's wrong in this line?
If I use this line instead, it works fine:
$classes[] = "someText";