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
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 at the 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 behavior 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. Β 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.
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 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.
Tools used: WP Database Optimizer /Β WP-DBManager
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
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.
32 Responses
For wp speed optimization lscache plugin also works best.
Is there any best optimizer tool to optimize any image without losing its quality?
There are a number of options you can try out, one of which is π
Great guide!
Hey Jean,
Thanks for the actionable guides.
Is there any good optimizer tool to optimize an image without losing its quality?
You can try out Perfect Images (WP Retina 2x)
Hi Jean
I was literally looking for WordPress Optimization article and my friend suggested yours
thanks a tons for posting such Detailed Post,
and you know the best part? you have added all the necessary links to help visitors
thanks π
Very useful article.
Is there any good optimizer tool to optimize an image without losing its quality?
Really informative but i waan know about if content is long that is affacted website performance
Does Akismet plugin increase database size? For customization, in your very good way.
What is the ideal number of plugins one must install so that website speed is not affected?
These are really useful WP optimization tips for everyone who loves to create a website.
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.
Hi Jean Galea,
Thanks for this great article.
Does the Akismet plugin decreases the speed of website?.
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.
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
Thank you it helps a lot
i will try the plugin, lets see how does it work.
Does the Akismet plugin increase database size? Well, in your very best way, for the optimization.
Thanks
Yes, website speed is decreased by using huge amount of plugins.
Does increasing of plugins decreases the speed of website.
HI Galea,
Does the Akismet plugin increase database size? Well, in your very best way, for the optimization.
Thanks
good instruction.thanks.
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.
Glad it’s helped you!
very nice article
em just going to bookmark you.. i really got usefull info….
thanks admin
Using a good theme and deactivating unnecessary plugins helps too.
Absolutely Ravi, thanks for your comment.
Very good article, with one omission. You do not mention anything about permalinks and the potential for overhead when they are mis-configured.
There is a good discussion here:
Indeed that is a valid point. Thanks.