Wordpress LScache Plugin: Role Excludes fails with multiple roles
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi. I am having problems with Role Excludes. I use the Members plugin that allows users to have multiple roles. What I am seeing is that LS Role Excludes only seems to recognize the first Role in the users list. Other roles are ignored. I need to exclude page optimization for users with a given role that appears after their first role so it is ignored by LS. Anyone else seen this or have any insights? Any help appreciated, thanks, Colin Litespeed: 3.6.4 WP: 5.7.2 PHP 7.4 Members: 3.1.5 | By MemberPress | Hi, add below code at top of your themes functions.php add_action(init, LSCWP_special_tweak) function LSCWP_special_tweak() $user_id = get_current_user_id() $user = get_user_by( id, $user_id ) if ( is_user_logged_in() && ! empty( $user ) && in_array( my-role, $user->roles ) ) define( LITESPEED_BYPASS_OPTM, true ) replace my-role to your targeted roles , you can add more elseif condition if you have to exclude more roles remember to purge all after you added it Best regards,
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference