I need custom CSS for admin. So if user is not logged in or is anything else but admin there is one CSS, and for admin only different CSS.
I tried this code in functions.php:
function wpa66834_role_admin_body_class( $classes ) {
global $current_user;
foreach( $current_user->roles as $role )
$classes .= ' role-' . $role;
return trim( $classes );
}
add_filter( 'admin_body_class', 'wpa66834_role_admin_body_class' );
and in custom CSS field:
#targetElement {
display: none;
}
.role-administrator #targetElement {
display: visible;
}
But it doesn’t work.