//WP QUERY EXAMPLE WITH MIXED AND & OR in a LIKE comparison
$retoArray = array(
'key' => 'reto',
'value' => $data->get_param('reto'),
'compare' => 'LIKE'
);
$zonaArray = array(
'relation' => 'OR'
);
//$zonaData = filter_var ( $zonaData, FILTER_SANITIZE_STRING);
//$zonaData = explode(',',$data->get_param('zona-articular'));
foreach($zonaData as $zona){
array_push($zonaArray,
array(
'key' => 'zona_articular',
'value' => $zona,
'compare' => 'LIKE'
)
);
}
query_posts(
array(
'post_type' => 'casos-estudio',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'title',
'meta_query' => array(
'relation' => 'AND',
$retoArray,
$zonaArray
),
));