I am struggling with a search filtering. Firstly, my script is searching for users using natural search SQL. The query returns ids of users. Now I would like to filter them by terms which are assigned to each user. I used this:
$terms_ids = array();
$terms_ids = $_GET['user_sport'];
$objects = get_objects_in_term($terms_ids, 'user_sport');
$unique = array_unique($objects);
print_r($unique);
But this get_objects_in_term function returns every object which has at least one term. What I want to achieve is the opposite thing. If one user has football as a term and does not have basketball he should not be displayed when I filter users with football and basketball. Only if I use football. Is there any way of solving this problem? Another approach would be second SQL query but I found out terms and taxonomies relations a bit weird just to write SQL query.