0

I want to display posts by categories. In my categories, I just want to display the posts that have the term meta between 100 and 200.

How can I do that properly?

0

This seems a little inconvenient since there are two hops from posts to terms to term meta. WP_Query cannot operate with term meta since it doesn't directly apply to posts.

Without knowing more context of your situation and term counts involved I would guess:

  1. Pre-calculate and cache the list of valid terms (those that fall into desired range of term meta value).
  2. Use pre_get_posts to modify term archive query by limiting posts returned to having valid term assigned with taxonomy query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.