For the homepage WP_Query loop, I need to get the most recent 20 articles, specifically to display the page title, excerpt, category, and date. I am doing the following:
$args = array( 'post_type' => 'post', 'posts_per_page' => 20, 'update_post_term_cache' => false, // don't retrieve post terms 'update_post_meta_cache' => false, // don't retrieve post meta 'cat' => -2301, //exclude this category 'orderby' => 'post_date', 'no_found_rows' => true, // counts posts, remove if pagination required ); $the_query = new WP_Query( $args );
However, I am seeing a lot of DB queries like:
SELECT tr.object_id FROM wp_term_relationships AS tr INNER JOIN wp_term_taxonomy AS tt...
As well as
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN ....
Which uses up server resources, particular as there are 25'000 posts and 50'000 tags. Is there a more efficient method to run this query, given that I only need the fields as per above?