I am on a mission to optimise a large site. The site has quite a lot of posts
On the archive page, only the excerpt, thumbnail and post title of a custom post type is displayed. The image and title both link to its respective page.
Each archive page has around 15 posts on it but returning 92 queries. Without any posts loaded, so just navigation and footer widgets there are around 40 queries.
I have read there is a way to stop WP from search the database for certain things, so literally just what I need.
Here is my current custom post type query:
<?php
$args = array( 'post_type' => 'venues', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => 15);
$loop = new WP_Query( $args );
if( $loop->have_posts() ):
while( $loop->have_posts() ): $loop->the_post(); global $post;
?>
<li class="venue-item" itemscope="" itemtype="http://schema.org/Article">
<div class="featured-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_post_thumbnail();?></a>
</div>
<div class="one-third">
<div class="venue-description">
<a href="<?php echo get_permalink();?>"><h3 itemprop="headline"><?php echo get_the_title(); ?> </h3></a>
<p itemprop="description"><?php the_excerpt() ?></p>
</div>
</div>
</li>
<?php endwhile; endif; ?>
Is there any way to optimise this query so only get what is needed from the database? It's not about making the page load faster as it's already super fast and sitting behind Varnish, it's about making the site scale as they're expecting a large traffic spike (from 1000 visits a day to around 5000 apparently) in the next week or two so anything I can do to help my server out is good for me!
There aren't many plugins active on the site; ithemes security, yoast, varnish purge and ACF so it's pretty good anyway just trying to see if I can do any more! Thank you in advance.