Regarding answer provided by birgirethis to this post: wp-query-to-show-post-from-a-category-or-custom-field

I found one issue with your solution. The two inner joins (term_relationships and postmeta) will only get results when a specific post has at least one term_relationship entry, otherwise the query won't fetch that post and will get a faulty result. How do I modify the code to get the expected results?


  • This is the "nature" of INNER joins used by the core here, try other types, like LEFT ones instead.
    – birgire
    Jun 10, 2015 at 7:53
  • Thank you birgire! How do I mark this as answered??
    – user74413
    Jun 14, 2015 at 6:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.