How to add custom query filters in WP_User_Query
The pre_user_query action hook in WordPress will allow you alter the SQL statements in the WP_User_Query object before they are run against the database. Note, this is an action, not a filter, so there’s no need to return the $user_query that gets passed in. add_action( ‘pre_user_query’, ‘add_my_custom_queries’ ); function add_my_custom_queries( $user_query ) { $user_query->query_fields .= … Read more