Trying to create a conditional CSS snippet based on user role
-
Basically what I’m trying to do is to remove an element using CSS for a peculiar user role. I tried the following snippet, but no luck.
$user = wp_get_current_user(); if ( in_array( 'customer', (array) $user->roles ) ) { add_action( 'wp_head', function () { ?> <style> .CSSselector: {display: none;} </style> <?php } );}
Please help. Thanks!
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Trying to create a conditional CSS snippet based on user role’ is closed to new replies.