As I’m sure most of you will agree, a slow or poorly performing site is a massive no, no. If a site takes more than 5-7 seconds to load, I will click back and try and find an alternative. Of course we don’t want that, we want to keep the visitors on your site as long as possible! So follow these steps to ensure your site is running as quick as it can.
As WordPress is PHP based this guide is aimed at WordPress installations hosted on our Linux platform.
Testing speed / load times
First we need a bench mark. The following tools are used to help identify any loading issues before we start to look at other potential WordPress fixes.
- gtmetrix.com – Uses Google Page speed and YSlow to give you a score and grade.
- Pingdom.com – Tests are done from pingdoms dedicated servers using Chrome.
- WebPagetest – A choice of locations, testing in Chrome, IE and FireFox.
- Google insights – Provides a rank for both mobile and desktop visitors.
- Yslow – A FireFox and Chrome addon that gives you on the fly website speed testing with just a couple of clicks.
- Pageload time – Simple chrome addon letting you know the time taken to load the site.
99% of the time you will need to add a couple of plugins to the site to get the functionality you require. While adding these plugins is an easy process, if there poorly coded or conflict with other code on your site the performance impact can be very noticeable.
What can we do?
Try to keep the number of plugins down, I’ve seen sites with 30+ plugins, half of them doing a similar if not the exact same thing as others. Know what plugins you need and know the functionality of them. Don’t add plugins for simple functions that can be done in the code. For example the Google analytics plugin is great, but adds additional overhead, just place the code provided in the footer of your theme.
Read the users reviews and comments and the developers replies and updates. A good indication of a well developed plugin is that it ensures full compatibility with the most recent versions of WordPress and the number of active installations.
You can see this information WordPress.org plugin page, for this example we’ve chosen the Akismet plugin.
How to figure out what plugins are causing issues?
The simplest method is to disable all the plugins, measure the site speed, enable another, test the speed and repeat. Not the most glamorous method, but it does give a clear indication of what plugin are causing any slowness and its easy.
Via a plugin
P3 (Plugin Performance Profiler) – A fantastic tool to help identify potentially problematic plugins. Just install using the plugins manager and run the scan. It will then provide you with a very detailed breakdown of your load times for each plugin, memory used, SQL queries, core load time, percentage of load time dedicated to plugins, etc.
Once you’ve identified a plugin that is causing slowness, disable and remove it. Disabling will stop it slowing the site down, but always remove them as there maybe potential for future security risk as its not getting updated.
Page & Browser
Page caching is a great way to help lighten the load on your site, the following plugins basically make a static version of your site to serve to visitors.
Now browser caching is a very useful trick, it tells your visitors browser what content to cache and for how long. This can be enabled simply by adding a the following lines to your .htaccess file
The above times can be edited to your sites requirements.
How to minify?
Plugins can do this, in fact W3 total cache has this option built in! If you’re not using this, then you can find other plugins in the WordPress plugin directory.
If you don’t want to go down the plugin route, then you can use one of the following online tools to perform this to your sites files,
Before you upload – Best method
Optimise them for web use, you do not need 300 dpi print quality images for a website. I’m not going to go to much into this as Google have produced an industry standard guide.
Using a plugin
I know i’ve said not to use too many plugins, but one you should use if you need to optimise your WordPress images as you upload them is, WP Smush. You can also optmise your historic image uploads to ensure they are all a small as they can be.
This one is a no-brainer, don’t use HTML to scale images. Create the image for the purpose, don’t use width and height in HTML to get the desired size. You wouldn’t believe the times i’ve seen a logo used in a header that’s scaled to be displayed as 300px / 50px but the actual image is 3000px / 1000px. And please no .BMP files.
Just to clarify compression and minifying aren’t the same thing. Compressed data has to be unpacked before it can be run, minified code can be read as is. You will of most likely heard of Gzip, its the most popular and effective method used for websites. Its an easy thing to implement and will reduce the page size and improve loading times.
Again we use a .htaccess file for this. Edit it and place the following code inside;
You can then confirm Gzip is enabled using this website.
Now doing all the above is very well and good, but if you have any errors generated by your site they will have a detrimental effect on performance. Enable error logging and click though your site thoroughly. We have guides for PHP error logging and general Linux error logging.
Last modified: 2021/05/21 at 10:22 by Jamie