Hi, thanks a lot, i have made the code bellow. And it is working.
Do you think, you could make something like this to make join queries or nested queries ?
I explain : Right now i have two custom post types (parent and child) Like Home and Room. I have to filter both in the same time, so to do that i have created relationship fields and i fill it on the room cpt, even if it concerns the home custom post type.
It works, but for me it not logical and clean, the clean thing would be to make join queries or nested queries.
----
My code
function add_city_tax( $query_args, $view_settings, $view_id ) {
if($view_id == 7706) {
//ville versaille = 158
//ville hyeres = 766
//CP 83400 = 1156
//CP 78000 1155
$args = array(
array(
array(
'taxonomy' => 'ville',
'field' => 'id',
'terms' => array( 766 ),
'operator' => 'IN',
),
array(
'taxonomy' => 'code-postal',
'field' => 'id',
'terms' => array( 1155 ),
'operator' => 'IN',
),
'relation' => 'OR',
),
array(
array(
'taxonomy' => 'dispositif',
'field' => 'id',
'terms' => array( 11 ),
'operator' => 'IN',
),
'relation' => 'OR',
),
'relation' => 'AND',
);
}
$query_args['tax_query'] = $args ;
$msg = '<pre>' . print_r($query_args, true) . '</pre>';
//mail('franck@efficonex.fr', 'test ok 8', $msg);
return $query_args;
}
add_filter( 'wpv_filter_query', 'add_city_tax', 99, 3 );