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'
);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.