Correct way to perform non-cacheable DB query

I am not completely sure what you are talking about so I will mention the possibilities that come to mind. Maybe this… // Keep track of the last query for debug.. $this->last_query = $query; http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/wp-db.php#L1195 … is what you are talking about. If so, your code just runs the flush method which resets $wpdb properties … Read more

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