Support

Account

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!