User roles custom css not working
-
Hi, I’m trying to load CSS on specific user roles following this post but for some reason is not working and I’m wondering why?
I’m trying to hide a field on the LatePoint plugin but only for the latepoint_agent role.
I tried as a snippet, on funtions.php but nothing works.
add_action( 'admin_head', function () { //Get current user ID, if the user is logged in. if ( is_user_logged_in() ) { $user_id = get_current_user_id(); } // Get the user object. $user = get_userdata( $user_id ); // Get all the user roles for this user as an array. $user_roles = $user->roles; // Check if the specified role is present in the array. if ( in_array( 'latepoint_agent', $user_roles, true ) ) { ?> <style> .os-col-12n {display:none; !important} </style> <?php } } );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘User roles custom css not working’ is closed to new replies.