One query to get posts and their taxonomy terms
According to user Otto, who provides a good explanatory answer to a similar question, you can safely call wp_get_post_terms() a number of times because WordPress’s internal query caching system is primed before the loop begins, and subsequent calls to wp_get_post_terms() will hit the cache rather than the query: Post meta information is automatically cached in … Read more