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?