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 optimization 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
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.
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. Oftentimes, 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.
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 optimization 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 that 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 of 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 optimization and repair.
5. Caching and Minifying
A good caching and optimizing 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
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.