function query_filter_valid_data($query)
 {
     $query->tax_query->queries = APTO_query_utils::filter_valid_data($query->tax_query->queries);
     return $query;
 }
function APTO_posts_distinct($distinct, $query)
{
    //check for NOT IN taxonomy operator
    if (isset($query->tax_query->queries) && APTO_query_utils::queries_count($query->tax_query->queries) == 1) {
        if (isset($query->tax_query->queries[0]['operator']) && $query->tax_query->queries[0]['operator'] == 'NOT IN') {
            $distinct = 'DISTINCT';
        }
    }
    return $distinct;
}