To follow my earlier blog on speeding up your Drupal site, here's how to make your WordPress site go like the wind.
A regular task for most websites is a review of their speed - generally focussed on initial loading time. When this is allocated as a job, it usually requires us to spend one hour making the biggest difference we can to the loading speed.
Benchmarking
Before we start we need to now how things stand before at the moment. Only then can we be sure if we have made a difference. To get a good measure of loading time, head to https://www.webpagetest.org/runtest.php. To get a good idea of what you should address to help improve loading time, go to https://developers.google.com/speed/pagespeed/. Google Page Speed will highlight the biggest issues facing your website. Not all should be looked into as a matter of routine, as often there is a reason for the way things have been done, however much Google thinks this is impacting performance. But nevertheless it's a handy crib sheet.
The process:
In order priority you really should:
W3 Total Cache
Add the W3 Total Cache plugin. This is a handy caching plugin that should improve performance, and takes care of things like minifying JS and CSS too.
Setting up W3 Total Cache can be something of an art, mainly due to the extensive array or options. A good place to start is the official documentation, which gives some recommended settings. As with most things WordPress there is a host of, often contradictory, advice out there should you wish to avail yourself!
One thing to remember, after adding this you'll need to clear the cache within W3 Total Cache's settings to see any changes you make to the website code.
Image Compression
You need a three pronged attack here.
Image Sizes. You should make sure all images are as small as possible. Always declare and add image sizes, or upload images no bigger than needed. If this is news to you, head to the codex here.
Optimisation. Make sure all your images are optimised. Google Page Speed will point out those images which wasting space: you can optimise them using either command line tools such as optipng and jpegtran, or web based tools such as tinypng and tinyjpg.
Optimise uploaded content. SmushIt is a handy plugin that can be used to both optimise content already uploaded and new content as and when it is uploaded by users.
Clear out redundant plugins and code
First, let's get one thing straight. As the world's most popular CMS, and something of a leaky ship, WordPress sites are prone to hacking. Therefore, removing all the plugins you don't actually use reduces the possible entry points to would be hackers - think of it as like bricking up windows.
But there is another reason - you're reducing the size of your site. So, go through and deactivate (and delete) any plugins that you don't need, along with JavaScript plugins and CSS libraries.
CDN
If you're downloading a lot of big images on a page, a CDN may help speed things up. This will put parts of your website on external servers distributed around the world and works as a cache to serve them up to the user as fast as possible.
We use Cloudfront from Amazon Web Service for CDNs. Cloudfront have some advice on configuring a WordPress site to work with its service, including integrating with W3 Total Cache.
Good work. But be careful of...
Google Page Speed may tell you to do things like change the order in which your JS and CSS files are loaded, to reduce the size of above the fold content. The trouble is, the order in which things load is often deliberate and critical to the site working correctly. It's best to leave this in a standard tune up as the returns are much lower than the potential harm it may cause. Godspeed!