Apply to multiple Roles
-
Hello,
i am trying to customize the backend and want to apply it to some roles.
But I can’t apply it correctly to multiple roles.
I tried to write like this:add_action( 'admin_head', function () { $user = wp_get_current_user(); if ( ! in_array( ‘user-role-1’,‘user-role-1’,‘user-role-3’, (array) $user->roles ) ) return; ?> <style> </style> <?php } );
I also tried like that
add_action( 'admin_head', function () { $user = wp_get_current_user(); if ( ! in_array( ‘user-role-1’, (array) $user->roles ) ) return; if ( ! in_array( ‘user-role-2’, (array) $user->roles ) ) return; if ( ! in_array( ‘user-role-3’, (array) $user->roles ) ) return; ?> <style> </style> <?php } );
but in both cases it is not good, how can I indicate more roles?
Thank you
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Apply to multiple Roles’ is closed to new replies.