How to optimise your WordPress site
- Guideline #1 - keep your site lean - use as few plugins as possible
- Guideline #2 - 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
- Monitoring your sites performance and further tuning
Before we get in to 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 plugins 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 all 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 plugins as possible
This might sound obvious - but it’s so often overlooked - every plugin 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 plugins as possible to achieve the result you want - there is no hard and fast rule. If a plugin is required ensure it is well coded and well supported (still current and being updated in the WordPress repository, or if its a paid-for plugin that the developer offers regular updates and good support - check the plugins changelog to see it’s update history. One of the most common causes of issue on WordPress sites is badly coded or out-of-date plugins.
You can find sites with only a handful of plugins running very badly, and well optimised sites with many plugins that perform quite well.
Guideline #2 - 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. 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!
If you are doing this image optimisation off-site then you’ll likely not need an image optimisation plugin on-site. That said, if your web server supports LiteSpeed (like all Krystal's shared servers) then you’ll likely get some additional benefit from its included image optimisation and we will explore that shortly.
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.
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 it's final destination.
Once you’ve got your SSL certificate active you’ll need to make sure your site serves all it’s contents over HTTPS:// rather than HTTP:// - to ensure you get that green padlock. We have a separate guide on fixing mixed content on WordPress (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 - go for the highest supported stable version 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 plugin that supports a newer version of PHP. If not, it may be worth seeing if there’s an alternative plugin that does.
Whilst you are in your control panel you should also find the PHP Settings/Options.
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 plugin 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.
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 plugin installed by default now.
If you install WordPress any other way, we have a guide on installing the WordPress LiteSpeed plugin.
The good news is, for most sites, you’ll see an improvement simply by enabling the LiteSpeed cache.
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 setup a cPanel cron job to replace it.
Monitoring your sites performance and further tuning
You can start to use tools like gtmetrix.com 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 plugins and functionality people start to see the sites load time increase. Quite often we find this is due to plugins 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, plugins, 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 plugin, 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.