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!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.