I think your problem is related with the use of the operator
argument in your tax_query
. Actually you are using IN
and NOT IN
. From your question I understand you want AND
. Also, you don’t need set terms
aguments to 0
if the $_POST[]
is not set:
if(isset($_POST['fac'])) {
// I assume that $_POST['fac'] is an array with the terms ID
// because you talked about an array of checkbox inputs in your form
// also, as you are using the field => 'id' I assume that the value of
// each checkbox is a term ID
$terms = array_map('intval', $_POST['fac']);
$facilitati = array(
'relation' => 'AND',
array(
'taxonomy' => 'facilitati',
'field' => 'id',
'terms' => $terms,
'operator' => 'AND'
),
);
$query->set('tax_query', $facilitati );
}
For further help I would need to know the expected data type of $_POST[‘fac’].