Support

Account

Home Forums Front-end Issues Cross-filtering by meta value Reply To: Cross-filtering by meta value

  • Hi,

    I found my answer :

    • field values must be meta queried one at a time (in the query definition), because you should try any order, and it could be mess with as less as 3 values
    • The basic query is on this model, section 3 (Multiple custom field values), since the field queried is a post, with potential multiple values
    • The relation is a “AND” in order to have the meta field like value1 and like value 2 and llike value3
    $values = explode(",", $values_str);
    $query_values = [];
    foreach($values as $value) {
    	$query_values[] = [
    		'key'		=> 'produit_categories',
    		'value'		=> $value,
    		'compare'	=> 'LIKE'
    	];
    }
    
    $args['meta_query']	=
    		'relation'		=> 'AND',
    		$query_values
    ];