Home › Forums › Front-end Issues › WP_Query search results with 's' and 'meta_query' at the same time. › Reply To: WP_Query search results with 's' and 'meta_query' at the same time.
Hi,
I was wondering the same thing and found the answer here: http://wordpress.stackexchange.com/questions/78649/using-meta-query-meta-query-with-a-search-query-s
It has a few extra steps but gets the job done.
Also, I noticed a little hiccup in my case. When the search was supposed to return nothing, it returned all posts. I solved the problem by wrapping the loop between an IF statement, like:
if(!empty($unique)) {
//wp_query here
}
For some reason, wp_query was returning all posts when post__in was an empty array.
Hope that helps!
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.