Home › Forums › General Issues › Create meta_query with relationship field? › Reply To: Create meta_query with relationship field?
Just came across this answer and thought it best to point out the the example above would cause issues with an id that has 16 in as it would match 116,161,1216, etc. and so the quotes around the value are important as per the comment.
So…
$args = array (
'meta_query' => array(
array(
'key' => 'bedrijf', // name of custom field
'value' => '"16"', // matches exaclty "16", not just 161. 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.