• Resolved colinfroggatt

    (@colinfroggatt)


    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 |

Viewing 1 replies (of 1 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    add below code at top of your theme’s 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,

Viewing 1 replies (of 1 total)
  • The topic ‘‘Role Excludes’ fails with multiple roles’ is closed to new replies.