How to optimise your WordPress site


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 "work" and process more data before or during the display of your pages. This will cause pages to load more slowly and will cause the site to feel slow for your 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 common 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 (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.

TIP - Gain an SEO advantage by naming your images appropriately before you upload them to your site! For example, if you sell watches on your site, name the image "rolex-submariner.jpg" rather than "Image1.jpg".

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 explains how you can get a free LetsEncrypt SSL certificate for your site! - (Link opens in a new tab)

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 and how to force your users to use your new certificate (Link opens in a new tab)

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 - PHP versions and tweaks.

This guideline may require you to make some changes on your web server. To complete this you will need to login to your cPanel Control Panel for your hosting (Link opens in a new tab).

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. Ensure that you 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 is not functioning as it should, try lowering your 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 likely that some of the code either on the site or within a plugin is misbehaving and will need to be investigated.  

(If this is the case then we would suggest speaking to a developer to have them investigate and repair the issue.)

Guideline #5 - Gzip.

We have a separate guide detailing how to enable compression for your site (link opens in a new window).

Guideline #6 -Caching (giving your site a tune-up)

Without caching, the server will have to build and deliver each page a user visits every single time. As you can guess, this tends to be very resource intensive. Caching allows the server to "remember" your page and serve a copy of this to your users rather than building it each time. This is much more efficient and will give your end user a much better experience.

Our servers run LiteSpeed Cache and we recommend using the Litespeed Cache plugin on your site to give the best expierience possible.

If you install WordPress any other way, we have a guide on installing the WordPress LiteSpeed cache plug-in (link opens in a new window).

For most sites, you’ll see an improvement simply by enabling the LiteSpeed cache.

If you want to improve things further you can also use the LiteSpeed Cache plug-in to combine and/or minimise your sites CSS and JavaScript. Rather than re-invent the wheel, here's a link to the LiteSpeed documentation (external link opens in a new window) that runs through all the other features.

Follow our separate guide to also take advantage of the LiteSpeed Cache Image Optimisation tool - link opens in a new window.

If you're on one of our Premium PCI-DSS compliant hosting packages (Sapphire, Diamond & Tanzanite), you can make use of Redis Object caching within LiteSpeed Cache!

We have a separate guide that covers enabling Redis on your Premium PCI-DSS compliant hosting account (Link opens in a new tab).

Guideline #7 - Disable the WordPress CRON job!

WordPress doesn’t have a built-in scheduler to run regular tasks, so to get around this it fires off a request to process wp-cron.php every time a visitor requests a page.

There are a couple of issues with this, firstly on busy sites this means this cron task will be running all the time - when it really doesn’t need to.

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

This can be a bit complex so 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 (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.

How did we do?

Powered by HelpDocs (opens in a new tab)
© Krystal Hosting Ltd 2002–