Support

Account

Home Forums Front-end Issues relationship -> query multiple values Reply To: relationship -> query multiple values

  • ok, got it !

    				$args = array(
    						'post_type' => 'maison-hotes',
    						'post__not_in' => $post_id,
    						'meta_query' => array(
    							'relation' => 'OR',
    							)
    						);
    				foreach($cities as $cities_id) {
    					$args['meta_query'][] =	array(
    						'key' => 'contact_city', // name of custom field
    						'value' => '"'.$cities_id.'"', // matches exactly "123", not just 123. This prevents a match for "1234"
    						'compare' => 'LIKE'
    					);
    				}