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
PS.
What I ended up doing, which is horrible and terrible for performance, is allow the query to run, and then in my loop, check *again* for the value:
if (in_array($ID, get_field('location'))) {
…and basically only run / output content in this if statement. This means it’s actually doing the query, retrieving the post, and then doing some junk crap to prevent it from showing up if we don’t past the in_array
test.
It works, but not good. Is there a better way to do this?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.