How to optimise your WordPress site
- Guideline #1 - keep your site lean - use as few plug-ins as possible
- Guideline #2 - Pre-optimise your images - keep them as small in file size as possible
- Guideline #3 - Use SSL
- Guideline #4 - Use the latest version of PHP and set your max_memory limit
- Guideline #5 - Make sure gzip compression is turned on
- Guideline #6 - Setup Caching (giving your site a tune-up)
- Guideline #7 - Disable the WordPress CRON job and set it up in cPanel
- Guideline #8 - Optimise your WordPress database
- Monitoring your sites performance and further tuning
Before we get into the nuts and bolts detail, it’s really important to understand a little about what makes WordPress so great. WordPress is hugely extensible - with a huge array of themes to make it look how you want and plug-ins to make it do what you want. This is a massive part of its appeal to many who want to be able to build and manage their own websites.
But, like all these things there is much more going on behind the scenes to make that ‘magic’ work. Some of this magic is tunable - and we will get to that in a bit.
Guideline #1 - keep your site lean - use as few plug-ins as possible
This might sound obvious - but it’s so often overlooked - every plug-in you add for a new feature or off-site integration - adds ‘weight’ to your site. When someone visits your website the server has to do more, process more data before or during the display of your pages. This will cause it to take longer - and so your site might take more time to load, or work more slowly for users.
Try to use as few plug-ins as possible to achieve the result you want - there is no hard and fast rule. If a plug-in is required ensure it is well coded and well supported (still current and being updated in the WordPress repository (external link opens in a new window), or if it's a paid-for plug-in that the developer offers regular updates and good support - check the plug-ins changelog to see its update history. One of the most issues on WordPress sites is badly coded or out-of-date plug-ins.
You can find sites with only a handful of plug-ins running very badly, and well-optimised sites with many plug-ins that perform quite well.
Guideline #2 - Pre-optimise your images - keep them as small in file size as possible
If you can, do this off-site - before you upload the images to WordPress. You can use Photoshop if you have it, or even something free like paint.net (external link opens in a new window). Your images should be set to around 72dpi resolution - this is plenty for screen viewing; and they should be sized, as near as possible to that at which you want them to display.
You want to aim for the smallest file size you can whilst giving an image quality you are happy with - when you view an optimised images’ properties it should be in the low Kb’s not Mb’s!
See also Step 6 for even more image optimisation.
Guideline #3 - Use SSL
Many hosts now offer free SSL certificates - this means your site can be accessed via https:// and show the green padlock. We have a separate knowledge base article that describes how to activate an SSL certificate for your domain - link opens in a new window.
If you collect any data (e.g. you have a contact form or newsletter sign-up), or sell anything you’ll need to be using SSL to conform with GDPR requirements to keep users data safe and secure between their browser and its final destination.
Once you’ve got your SSL certificate active you’ll need to make sure your site serves all its contents over HTTPS:// rather than HTTP:// - to ensure you get that green padlock. We have a separate guide on fixing mixed content on WordPress (link opens in a new window) - when you get a warning on the page or see the Orange padlock.
The next guideline will require you to make some checks and possibly make changes on your web server. To complete this you will need to login to your cPanel Control Panel for your hosting.
Guideline #4 - Use the latest version of PHP and set your max_memory limit
PHP is the language that WordPress sites run on. There are various versions widely available, currently some 5.x version and some newer 7.x version. And, in this case, newer is definitely better - moving a site from 5.x to even 7.0 can give quite a performance boost due to the optimisations made in the newer PHP version.
So, hop on to your hosting control panel and change your PHP version (link opens in a new window) - go for the highest supported stable version (external link opens in a new window) you can - check your site after you’ve changed it to make sure everything still works as expected. Check every page and every piece of functionality - contact forms etc. If anything breaks try a lower PHP version - or better yet see if there’s a newer version of that plug-in that supports a newer version of PHP. If not, it may be worth seeing if there’s an alternative plug-in that does.
Whilst you are in your control panel you should also find the PHP Settings/Options (link opens in a new window).
Look for the max_memory option - set this to around 512Mb. Here it’s absolutely not the case that more is always better. If you find that your site is having issues even with this set to 768Mb or higher then it’s possible something isn’t working as you expect, or a plug-in or some other code is misbehaving. If this is the case then you’d be best advised to get a developer to take a look and fix whatever is broken.
Guideline #5 - Make sure gzip compression is turned on
We have a separate guide detailing how to enable compression for your site (link opens in a new window).
Guideline #6 - Setup Caching (giving your site a tune-up)
Caching is the process of having your hosting server ‘remember’ often served pages or other content and serving that to further client requests from memory, rather than going and creating the page again. This often provides a massive performance boost.
New WordPress sites created using Installatron or Softaculous will have the LiteSpeed caching plug-in installed by default now.
If you install WordPress any other way, we have a guide on installing the WordPress LiteSpeed plug-in - link opens in a new window.
The good news is, for most sites, you’ll see an improvement simply by enabling the LiteSpeed cache.
Follow our separate guide to also take advantage of the LiteSpeed Cache Image Optimisation tool - link opens in a new window.
Guideline #7 - Disable the WordPress CRON job and set it up in cPanel
We have a separate guide detailing how to turn off the WordPress Cron job and set up a cPanel cron job (link opens in a new window) to replace it.
Guideline #8 - Optimise your WordPress database
We have a separate guide detailing how to optimise your WordPress database (link opens in a new window).
Monitoring your sites performance and further tuning
You can start to use tools like gtmetrix.com (external link opens in a new window) to benchmark your site - please be aware that these sites are only ever a guide and that sometimes there are good reasons not to chase a number - for example, it may be better to load a bigger image once and show resized versions on the same page rather than loading multiple images. So, a lower score for image optimisation might not be a bad thing.
Likewise, particularly on sites with more plug-ins and functionality people start to see the sites load time increase. Quite often we find this is due to plug-ins calling others services - sometimes Google fonts, sometimes it’s a social feed - and it’s these off-sites services that are taking some time to respond - not the actual hosting server. The best way to see this is by looking at the waterfall view - you will see here what connections are being made to resources off-site and how long they are taking to load.
At this point, you’ll understand that there are a massive amount of variables (WordPress version, themes, plug-ins, PHP version etc.) - and one-size rarely fits all. It’s possible to achieve great results by further tuning your use of the LiteSpeed cache plug-in, but make sure to test and check every change you make to ensure everything still works afterwards. If you can, always test on a development or staging site - it will allow you to make changes and test tweaks without impacting your live users.