WordPress Speed Optimization Guide

The load speed of your website is essential, you need a fast site because slow sites annoy users, meaning less visitors to your site. Secondly, search engines also consider the speed of your site when generating their rankings. There are a number of factors influencing the load speed of a WordPress site, so in this post we will examine the top 5 factors that affect WP site load speed.
Our Sponsors
Essential plugins for your WooCommerce store
Build unbuildable WordPress websites
Try Kinsta WordPress hosting risk-free for 30 days
The best no-code Instagram feed plugin for WordPress
Automate marketing for WooCommerce, from hi to buy!

The load speed of your website is essential, you need a fast site because slow sites annoy users, meaning less visitors to your site. Secondly, search engines also consider the speed of your site when generating their rankings. There are a number of factors influencing the load speed of a WordPress site, so we will examine the top 5 factors that affect WP site load speed:

1. Hosting Provider

All the optimisation in the world won’t save your site unless it is hosted on a good server. If your site attracts thousands of visitors you might want to check out a Content Delivery Network (CDN), else just try to stick to quality hosting which has a good uptime and powerful hardware. If you are interested in setting up a VPS for your WordPress site, check our setting up a VPS guide. You can have a good indication of how fast your site is by taking the speed test here. Compare the results with your competition and see whether you need to improve your performance. Once we have a good dedicated server we can take the next step of examining the actual size of the pages we are loading.

2. Page Size

Pages on your website consist of several elements such as images, JavaScript, CSS, flash and video. Adding up the size of all these elements will give you a total number of KB that needs to be loaded by the browser in order to view the page. So we need to reduce this as much as possible in order to save on bandwidth. We can compare this to pouring water into a funnel and into a cup. A funnel has as a specific limit of water it can pass through at any time. Thus by reducing the amount of water we are pouring in, the whole action is completed earlier.

To examine the size of the different elements used on your page you can use Firebug together with YSlow, both Firefox plugins, so you need that browser too if you’re not already using it. WP Smush.it is a WordPress plugin that automatically compresses the images inserted in your pages or posts, thus minimising the total size of the site’s pages.

Another tip for reducing page size is selective loading of files such as plugin JS and CSS. For example, if you are using a contact form plugin and only use the contact form on the ‘Contact’ page, there is no use for loading the plugin’s JS and CSS files on every page of your site. You can therefore use WordPress conditionals to only load the files required by the contact form plugin on the ‘Contact’ page. Unfortunately at present not many plugins offer the option of selective loading, however you can still use selective loading of your own files, for example if I am using a JS animation on only one particular page, I would use WordPress conditionals e.g. if ( is_home() ) to only load it for that page.

Finally you should also follow the common practice of loading CSS files in beginning of the page and JavaScript files at the end of the page (when possible). CSS is needed for the look of the page and is therefore loaded first, but JS is usually more bandwidth intensive and concerns the behaviour of the page, thus can be loaded later. Ideally your page size should be below 50KB.

Tools used: Firebug, YSlow, WP Smush.it

3. Number of Database Requests

A WordPress site should not be making more than circa 25 queries to load any page on your site. So try to keep the number below that. If you observe too many queries being made, start by checking whether any plugin in particular is making many queries, unfortunately some plugins are not perfectly designed and can burden your site with many unnecessary requests. If any such plugins are found it would be a good idea to email the plugin author or fix them yourselves if you are comfortable with code wrangling. Until the issues are fixed remove the offending plugin, if you lack coding skills and the plugin author does not respond, try to search for an alternative plugin.

A handy tool to use is P3 Plugin Performance Profiler. This plugin creates a profile of your WordPress site’s plugins’ performance by measuring their impact on your site’s load time.  Often times, WordPress sites load slowly because of poorly configured plugins or because there are so many of them. By using the P3 plugin, you can narrow down anything causing slowness on your site.

Tools used: Debug Queries, P3 Plugin Performance Profiler

4. Database Optimisation

Over time, your WordPress database can generate what’s called ‘overhead’. This condition is similar to a defragmented hard drive. Fortunately plugins exist that take care of fixing this automatically. Both WP Database Optimizer and WP-DBManager do a good job, most importantly allowing you to schedule automatic maintenance and optimisation of your WP database.

WP-Optimize gives you even more features, including the ability to delete post revisions or spam comments. This can be a good plugin to run once in a while, unfortunately it doesn’t have any scheduling functionality. Why would you delete post revisions, you may ask. Well, as an example, if you have a post which is approximately 100KB data and you have 5 revisions of that post, the total space wasted is about 500KB. And if you have 100 posts similar to it, you have 50MB database space wasted. We don’t want that, hence the need to clean post revisions every now and then. I usually run this plugin once a year or so.  This article on WPMU.org expands more on the topic of WP database optimisation and repair.

Tools used: WP Database OptimizerWP-DBManager

5. Caching and Minifying

A good caching and optimising plugin is essential to give a good boost to your WordPress site speed. The best WordPress caching plugin at the moment is W3 Total Cache. I’ve regularly shaved seconds off the loading time of WP sites after implementing this plugin. It could for example cut your load time from 3 seconds to half a second when implemented correctly. WPBeginner run an excellent tutorial on setting up W3 Total Cache.

Tools used: W3 Total Cache

Conclusion

Implementing the suggestions above should put you well on your way to having a very optimized WordPress website. Use the speed test mentioned in this post to evaluate the success of your efforts, testing your site after implementing the recommendations illustrated in each of the 5 points above.

Also make sure to check our post about WordPress System Monitoring Plugins, which will help you understand if you have any issues with your WP installation.

Hope this guide is helpful, and if you have any more WordPress optimization tips which I’ve missed, you are welcome to let me know in the comments section.

Jean Galea
Jean Galea
Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Consider sharing this post so others can find it:

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on pocket
Share on email

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services just like this one every week.

Table of Contents

30 Responses

  1. I’ve started building more complex WP sites recently – and they’ve begun to slow down. This post is a godsend – and enough in itself to get mt to subscribe to your RSS feed.

    Thank you.

  2. its wonderful article and very helpful for increasing the speed of website but one question in mind does using the plugin more reduce website speed

    1. Hi Vikash,
      all plugins have acquired some space. So Its totally dependent on your hosting plan. If your hosting is good then it’s not affected, but if your hosting is not good then your site will definitely go slow.

  3. when I add Google AdSense ads on my blog. it’s going very slow. like- in mobile 85 to 30. then how to solve this problem. and another thing is custom https redirects. how to solve it. please reply.

  4. What is the ideal number of plugins one must install so that website speed is not affected?

Leave a Reply

Your email address will not be published. Required fields are marked *

The Beginner’s Handbook
From an introduction on how WordPress works to our recommendations on products and services.
👋 Hey there! We're Gaby and Mark
Every week we share genuine reviews of WordPress products and services in our newsletter.
Thousands of people read it!
We’d love for you to join.
We’d love for you to join. Here’s what you’ll be getting:

A single weekly email directly to your inbox.