Home › Forums › Front-end Issues › Multiple ID's in relationship field — LIKE query returns inappropriate posts › Reply To: Multiple ID's in relationship field — LIKE query returns inappropriate posts
It shouldn’t match both
127 because it has extra double quotes there:
'"' . get_the_ID() . '"'
For example, if
2, then the query would be like this:
'value' => '"2"',
Which will only match serialized string that has
"2" in it like this:
And not this one:
Could you please test it again by providing the value manually like this:
'meta_query' => array( array( 'key' => 'location', 'value' => '"2"', 'compare' => 'LIKE' ) ),
Also, could you please check the database if there’s extra ID there?
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!
© 2022 Advanced Custom Fields.