Reply To: Limit autosugesstion to users with specific meta value


Home Forums Front End PM PRO Limit autosugesstion to users with specific meta value Reply To: Limit autosugesstion to users with specific meta value

#38752
shamim
Keymaster

You can add following code in your theme’s (child theme’s if you are using) functions.php

add_filter( 'fep_filter_rest_users_args', function( $args ){
    if ( in_array( 'mentor', wp_get_current_user()->roles )  ) {
        $args['meta_query'][] = [
            'key' => 'mentor',
            'value' => get_current_user_id(),
        ];
    }
    return $args;
});

(untested)
Change mentor role and meta key in the code as you require.
Let me know.