0

I have been trying to group custom posts based on the taxonomy terms as shown in this article. Here is another similar post:

That does the job but I am worried about the number of WP_Query being looped. What if we had somewhat larger number of terms? In such case, there will be repetitive database queries.

Is there any better approach to get the same result.

I am thinking of using WordPress transient but that I guess is another side. Is doing raw sql queries any better?

migrated from wordpress.meta.stackexchange.com Oct 7 '15 at 8:56

This question came from our discussion, support, and feature requests site for WordPress developers and administrators.

  • 1
    Good morning! Please don't post such questions on meta. Or grab a morning-coffee before posting if you already knew :) – kaiser Oct 7 '15 at 8:57
  • Was a mistake. Sorry for that :) Haven't been using stackexchange for quite a time. Thanks for migrating. – Rabin shrestha Oct 7 '15 at 9:19
  • 1
    I have a ton of posts using usort to sort posts according to post type, taxonomy terms and custom fields. Feel free to search my answers for usort. The solution you linked to is very expensive :-) – Pieter Goosen Oct 7 '15 at 11:12

Your Answer

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

Browse other questions tagged or ask your own question.