Home › Forums › Front End PM PRO › Limit autosugesstion to users with specific meta value › Reply To: Limit autosugesstion to users with specific meta value
June 23, 2020 at 10:48 pm
#38752
Shamim Hasan
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.