Home › Forums › ACF PRO › Continuous loop in Relationship field with custom title + custom search › Reply To: Continuous loop in Relationship field with custom title + custom search
So, this is just a theory, but when you do a search, ACF uses the standard WP_Query to get posts and it sets the ‘s’ parameter in the query. This searches the title and content of the post for the keywords. When you add a meta query I’m pretty sure that what you end up with is something like this
(title LIKE keyword OR content LIKE keyword) AND meta value LIKE keyword
Which means that you’ll never find anything unless the sku is also in either the post title or the post content. Again, this is just a theory.
What you can try is to unset the ‘s’ argument, so that you only search the sku field.
Either that or you can look at the ‘s’ arg and try to determine if it looks like a sku, if it does then add you meta query and unset the ‘s’ arg. This would let you search by title or sku, but I don’t know if this is possible.
Like I said, at this point it’s just a theory that the ‘s’ arg is causing the issue.
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!