I have filtered posts, pages and custom_post_types based on $current_user custom usermeta field values using pre_get_posts().
Is there a similar method/function to alter get_users() based on $current_user custom field values? I’ve searched quite a bit but came up empty handed.
For example, let’s assume I want to filter the results of get_users() for an editor with the “town” custom meta of “Paris” to only return the list of users with the same value in “town” field. Similarly, an editor with “Rome” in “town” should get only users from “Rome”, and so on…
Ideally, I’d like this parameter to append itself to all get_users() done by the website’s functions in both back and front end as long as the user is logged in.
Is this possible in WordPress?
Thank you.