- 1 How to use this guide to speed up WordPress
- 2 Why you need a faster WordPress website
- 3 How to check your WordPress site speed
- 4 Does server speed affect SEO?
- 5 What factors affect a WordPress site’s speed?
- 6 How to improve your WordPress speed
- 6.1 Start by running a benchmark test
- 6.2 Update your WordPress (Simple)
- 6.3 Be careful running a free or heavy theme (Simple)
- 6.4 Remove unwanted plugins (Simple)
- 6.5 Optimise your page’s images (Simple)
- 6.6 Set your Expires Headers (Expert)
- 6.7 Remove Query Strings from Static Resources (Simple)
- 6.8 Reduce social media calls (Simple)
- 6.9 Optimise your database (Advanced)
- 6.10 Install a caching plugin (Advanced)
- 6.11 Make fewer HTTP requests (Simple)
- 6.12 Don’t embed video (Simple)
- 6.13 Don’t embed Google maps (Simple)
- 6.14 Configure a CDN (Expert)
- 7 A final word
How to use this guide to speed up WordPress
Although this looks like another one of those ‘too long, didn’t read’ guides, the beauty of it is that you don’t need to follow all the steps. Just work your way down the list and take on the areas you can – every one of them will help shave vital miliseconds from your WordPress load speeds and help you speed up WordPress, driving more traffic and user engagement.
Why you need a faster WordPress website
According to Google’s research, the average website takes a whopping 22 seconds to load on mobile and yet 53% of mobile visitors leave a page that takes longer than 3 seconds to load. In Google’s own words: ‘That’s a big problem’.
Users want a frictionless experience; images that get in the way of the guide you want to read, a video that autoplays when you load the page or a page that loads slowly – they’re all examples of friction. Too much friction and you’ll abandon a website. Your customers are no different to you.
Now is a good time to remind you that Google has been talking about page speed as a ranking factor since 2010.
In short: you cannot afford to be slow!
How to check your WordPress site speed
There are lots of tools out there that can test the speed and performance (more on this later) of your website. There are three that we regularly use to help us understand and improve our client’s sites:
Our go-to tool is GT Metrix. It provides a great overview of how your site is performing, showing you a PageSpeed and YSlow (Yahoo’s speed test) score. It also shows you the page load time, page size and the number of requests (the number of files required to fully load the page).
We benchmark all of our client’s site with GT Metrix. You can download a PDF report each time you run the test and if you create an account you can see a site’s history and track its progress. GT Metrix also has a waterfall report, which shows you each file that’s loaded, the order it’s loaded in and the time it takes to load.
When it comes to website speed testing tools, GT Metrix is a crucial addition to your arsenal.
Another great tool is Pingdom, which is similar to GT Metrix. It is equally visual and very handy when it comes to improving website speed. However one drawback to Pingdom is that it won’t recognise a CDN (See our What is a CDN guide) and it doesn’t give you an absolute rating, it just compares you to all the other sites it has tested.
Google Page Speed Insights
OK, so Google’s Page Speed Insights doesn’t actually report your website’s load speed in seconds but what it does do is give you a deeper understanding of what can be improved on your site. PSI analyzes your page’s content and suggests the areas you can improve to optimise your website’s load speed.
PSI gives you a score out of 100 for both mobile and desktop. It’s worth noting, Google offers you the Mobile results first (hint: Google loves mobile!), so pay attention to your mobile score.
While a score of 100/100 is not impossible, it is improbable. When we perform our WordPress Speed Optimisation service, we advise our clients not to chase a 100/100 score. There’s more to a perfect website than a perfect Google Page Speed score. For example, this website gets an almost perfect score but it’s not, as you can see, a perfect website. However, it is quick.
Does server speed affect SEO?
Google has consistently made it clear that it looks at how long it takes a website to load and that page speed is a ranking factor. Therefore it’s hard to argue that your server speed isn’t important. No-one knows exactly how important page speed is in terms of Google’s algorithm but it is likely to be a more important factor when it comes to mobile.
What Google does consider is – not the Bounce Rate of a page but – whether you return to the search results page and what you click next. If a user gives up waiting for your site to load, returns to the search listings page and clicks another result, your result may slip down the rankings.
Your server’s response time, latency, uptime and overall performance aren’t going to affect your rankings dramatically. If you have poor content, a fast server won’t save the day. If you’re with a ‘known’ host, you’re going to be fine.
Some of our clients want to ‘ditch their server’ and get onto a faster one, thinking that will be a silver bullet that will enhance their SEO but there are many issues and pitfalls that can arise when you move host and often the risks don’t outweigh the rewards.
There is no perfect host but two we’ve had consistently good experiences with are: Siteground (great for WordPress and smaller sites around 10,000 visitors a month) and Nimbus (slightly more expensive but their support is second to none).
When it comes to speed, it’s not always the server or your web host that are to blame. There are key areas of your site that you need to ensure are optimised in order that every user has the best possible experience, regardless of the server you’re on.
What factors affect a WordPress site’s speed?
When most people test their site, they’re testing the homepage and not a deeper page on their site. This is fine, as the majority of the structure on your site is common throughout the site but often the homepage is the slowest loading page on a site, because it has the most elements.
Broadly speaking your WordPress site’s speed will be affected by the following:
A heavy theme
With great themes costing under £50 ($60), it’s not worth taking the risk with a free theme. Some free themes are great but you have to tread carefully. A great place to buy themes is Themeforest’s marketplace. This is a link to their top-selling WordPress themes.
The great thing about WordPress is that there is a plugin to do anything. The bad thing about WordPress is that there is a plugin to do anything. Plugins can dramatically affect a site’s speed, even those designed to improve speed can cause issues if they’re not configured properly. Badly coded or outdated plugins are a killer when it comes to your WordPress performance. Further below, we’ll recommend a couple of plugins to help you improve your WordPress site speed.
As mentioned above, server speed makes a difference but unless you’re using a clearly terrible host (unpredictable performance, lots of downtime, poor support) then it’s best to carry out all the other optimisations listed in this article before considering moving to a new host. If you do move to a new host, the good news is you can port your highly optimised site over to a faster server and take the handbrake off!
It may take 100 elements (also known as requests) to render your WordPress homepage but if one of those elements is a large image, that may make your WordPress very slow.
Some plugins will add queries to the database and therefore add to the amount of time required to serve a page. Sometimes when you remove a plugin, it leaves behind the tables it created in the database, causing your database to be more bloated and slower than it needs to be.
How to improve your WordPress speed
The following guide will walk you through all the elements you can address to speed up your WordPress site. You don’t need to do them all but the more you do, the faster your site will be.
We’ve labelled each step in terms of its complexity:
- Simple (We think anyone who can post a post on WordPress than do this)
- Advanced (You use WordPress daily, have installed a few plugins, you might have even built your own WordPress site)
- Expert (WordPress is how you earn a crust).
We suggest you focus on one page – make it the homepage – as the majority of the improvements you make will benefit the entire site.
Start by running a benchmark test
Let’s start by benchmarking your site. Head over to GT Metrix and paste in your website’s domain name. Set your test to a location and device that you keep fixed for all future tests so you can compare like for like. We’ve chosen London and Google Chrome. Run your GT Metrix test three times, yes, three times! This way you can get a good average to work from.
Your result will look like the image above. As you can see, this is not a fast site. Looking at the Page Details section, we can see the time to load is 16.3 seconds, page size is 10.9MB and the number of requests is 150. From doing 100s of these tests over the years, my gut feeling says there are large, unoptimised images on this page, there’s a fair bit of bloated code probably due to plugins and there are a lot of requests – again most likely due to plugins. Finally, it’s likely the server in this example is a slow server.
The risks with a slow WordPress site
The risk for a slow WordPress site like the example above is that it takes so long to serve one user one page, that it’s likely the database will struggle to keep up with the total amount of requests from all users and get tied in knots while it tries to keep up. Often these sites crash and all users will see the dreaded ‘Error establishing a database connection’ message.
Update your WordPress (Simple)
It’s a sensible idea to keep your WordPress updated to the latest version. Not least for security reasons but also to keep your site running smoothly. Ensure your theme is setup as a ‘Child’ so that any updates to WordPress won’t break your site.
Be careful running a free or heavy theme (Simple)
OK, so it might be too late to talk about themes because the chances are you’ve already built your site.
However, it’s worth looking at the top-selling theme creators on sites like Themeforest. They won’t be successful by selling bad themes but at the same time, themes with tonnes of built-in functionality might be bloated and slow your site down.
Everyone’s situation is different. Ideally you’ll find the lightest possible theme and work with a developer to add in only the functionality you need. It’s easier to add a few functionality improvements and plugins than it is to strip back a heavyweight theme. It’s very easy to switch themes, so if you’ve just installed an off-the-shelf theme and suspect it might be heavy and slow, you can find a new one and replace your existing theme with just a few clicks. Just head to WordPress Admin > Appearance > Themes to change yours.
Our tip: Go to the demo page of the theme you’re interested in and paste that URL into GT Metrix to see the page load speeds and scores. If it takes a long time to load and has a lot of requests, you may be better off finding a different theme. Always read the reviews and look out for people who comment on the theme’s speed.
Remove unwanted plugins (Simple)
To see what plugins you’re running, login to your WordPress admin area and click on Plugins on the left-hand menu.
In the first instance, you should remove plugins that you know you’re no longer using. Some plugins will double-up, offering similar features and in some cases clashing which can slow your load times.
It takes time and knowledge to prune back a WordPress site’s plugins but the first rule is: only install what you really need. For instance, a plugin that injects your Google analytics tracking ID into every page is not as efficient as hard-coding the tracking code into your header.php file. So that’s an example of where you don’t need a plugin.
Optimise your page’s images (Simple)
Jay-Z’s famous rap hit about WordPress optimisation: ‘I’ve got 99 requests and an image is one’ was bang on the money.
Image optimisation example
Check out the main image on the homepage of one of our client’s sites. It looks fine at first glance. However if you take a look at the screenshot below, you’ll see how big the image really is.
This image is almost 3000 pixels wide and hi-res, it’s around 1.5MB. The other elements on this page add up to 0.5MB. That means 75% of this page’s size is down to one file.
You don’t need a 3000px wide image and you don’t need it to be hi-res. When you load a 3000px image, your browser (whether that be desktop, tablet or mobile) will need to render that image and constrain its size to fit. So you’re loading an image that is physically far larger than it needs to be and then wasting more time squeezing it into a size that works on the page. You’re shooting yourself in the foot, twice!
We resized this image and then optimised it, reducing its size to just over 200kb. There are 5 of these images on the homepage, so we reduced the total image size from 7.5MB to just 1MB.
WordPress image optimisation plugin
If you have lots of images on your site, then you can use a plugin like WP Smush to compress your images and speed up WordPress but when it comes to the homepage, we highly recommend doing it manually. Most image optimization plugins won’t question your image’s physical dimensions, they’ll just optimise whatever they come across.
As in our example above, a 3000px wide, 1.5MB image might be reduced to 500kb with an image optimiser but if you want to properly optimise it, you’ll need to resize that image in a program like Photoshop and then optimise it, then re-upload it.
Obviously, if you have 100s of images on your site, a shortcut like WP Smush is a good solution but it’s not as good as a good old-fashioned manually optimised image.
Find your problem images
There’s a great tool you can use to crawl your website and find your problem images, it’s called Screaming Frog. If you have fewer than 500 URLs to crawl, you can download SF and use it for free. Just enter your domain name, run the report and then look down the right-hand menu for the Images menu and then Images over 100kb. This report shows you all of your images that are over 100kb in size.
Although there’s no set rule for just how big your images should be, this handy tool gives you a hitlist of the worst offenders. You can save those files, resize them, optimise them and re-upload them.
Long homepage, with lots of images?
If you’ve got a long homepage with a load of images, then consider a lazy loading plugin, this will look at the viewport if your visitors device and only load images below the fold once the user scrolls down.
Set your Expires Headers (Expert)
Expires Headers tell your browser whether it needs to download website content from a server or whether it can use the files it has already downloaded.
If you don’t set expires headers, all files will be requested from the server every time you load a new page. The benefit of expires headers is that most websites have a huge amount of common files, so once you’ve visited one web page on a website, the next page you visit will load faster as there are fewer files to request from the server. This is probably one of the best ways to speed up WordPress.
How to set Expires headers on WordPress
You’ll need to access your .htaccess file which is a hidden file in the root directory of your website. You’ll need FTP access (which you can often get through cPanel).
- Login to your cPanel.
- Select File Manager from the Files section.
- Locate your .htaccess file (if you can’t see it, choose Settings > Show Hidden Files as it’s often hidden).
- Make a copy of your .htaccess file and rename it .htaccess-BACKUP – you can revert to this should thing go wrong.
- Right-click on your .htaccess file and click on Edit.
- Paste in the script shown below and then save the document:
# Enable expirations
# Default directive
ExpiresDefault "access plus 2 weeks"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 2 weeks"
What the code above does is enables expirations, sets a rule to cover all the files not specifically mentioned (in this case, access plus 2 weeks) and then we’ve defined the expiry for all other file types. You can change the code to whatever you need but these default settings are what we use for a majority of our clients.
You may find your .htaccess file has lots of other code in there. Some plugins will write to this file, you may also have redirects in here.
Once you’ve pasted in your code, head back to GT Metrix and retest.
Remove Query Strings from Static Resources (Simple)
The question mark (?) in the string can prevent some servers from being able to cache that script.
If you want to know how to remove query strings from static resources, it’s easy: just install this plugin. Once activated, you should re-test your site in GT Metrix. It might not be much faster (as generally speaking these files aren’t huge anyway) but it will stop you seeing the issue being flagged in GT Metrix and Pingdom and will mean your GT Metrix scores rise towards the magic 100%.
It’s easy to connect up your WordPress website to your social media channels. I don’t want to ruin the party but I do want to let you know that social media calls slow your WordPress website down. Party pooper over here, I know.
Here’s an example of a client’s homepage, with 8 Instagram images at the bottom of the page:
Aside from slowing down the homepage with these additional elements, what I find concerning is that by having your Instagram feed here, you’re just sending visitors AWAY from your website to Instagram, where they’re not going to convert. If you’re using social media, it should be driving traffic to your website, where you can convert your visitors who have been aroused (inspired?) by your social media feed.
Take a look at the screenshot below of the Pingdom speed test for this site. Instagram adds over 10% to the page’s size but also nearly 20% of requests. The total time it takes to load these Instagram images is 1.25 seconds; a quarter of the total page load time.
Optimise your database (Advanced)
It’s a really good idea to optimise your database regularly, this is a safe and sensible way to speed up WordPress. A free plugin, such as WP-Optimize is a great place to start. It removes all unnecessary data plus pingbacks, trackbacks and expired transient options. It can be configured to run weekly clean-ups and de-fragment MySQL tables. It also shows you handy statistics of what has been optimised.
If you’ve been running WordPress for a long time, you may also be running the older MyISAM database structure. These days, WordPress has moved onto InnoDB which has been proven to run faster. This post gives you an easy guide on how to convert. The site will run faster on Inno DB.
Install a caching plugin (Advanced)
Simply put, every page or post on your WordPress site is dynamically created – that means lots of database requests are made to bring together all the page’s components. This puts a load on the database and means the page takes time to be ‘put together’.
A caching plugin creates a ‘static’ version of all the pages on your site and this ‘flat’ file is served when the page or post is requested, rather than generating the page on the fly. This hugely reduces server overhead and ensures the page is delivered rapidly.
There are lots of caching plugins available for WordPress but one we have had consistently good results with is WP Fastest Cache. With over 400,000 active installs and over 1,600 five-star reviews, we probably don’t need to try and sell it to you.
Best WP Fastest Cache settings
Your settings will depend on what other plugins you’re running but start with these settings and see how you get on:
The below screengrab from GT Metrix show the results of the site before (top) and then after turning on WPFastest Cache (bottom).
Make fewer HTTP requests (Simple)
Don’t embed video (Simple)
Never upload a video to your server via the WordPress interface. Always use Youtube (or whichever video hosting service takes your fancy). If you upload a video to your server using the WordPress interface, you’ll be using up a lot of bandwidth every time that video is played and you’ll be adding load to your server. It’s a big no-no in my book.
Before you jump on to Youtube to upload your video, ask yourself: Do I need a video on my homepage?!
Even embedding video via a third-party service will add calls and slow down your homepage speed. Youtube adds approximately 7 calls just for the video plus there will be other calls that come with it, like a call for Doubleclick (Google’s ad-serving platform).
The best WordPress video embedding solution
Solution 1: The fake video
The lightest solution is to upload your video to Youtube, then take a screengrab of the video. Then take that image, paste it into your image editing program and crop it so that it looks like a video embed. Then upload that optimised image to your homepage, with a target=”_blank” link to throw the user a new window with a link to your video.
Solution 2: WordPress Video Lightbox
There’s a nifty plugin called WP Video Lightbox. What this does is throws open your video in a lightbox when you click the thumbnail. This means the video elements aren’t loaded until the user clicks to play the video. Clever stuff. Once the plugin is installed, you just add your third-party video URL (Youtube, Vimeo, etc) and the plugin creates the thumbnail and does the hard work for you.
Don’t embed Google maps (Simple)
Google Maps is a nice touch to have on your website, but do you need to have it on your homepage. Do you even need to show the map at all? Nope!
There are over 20 Google Maps-related requests on this page out of 84 requests in total. That’s a lot of additional weight. It’s over half a second in additional load time.
First things first, do you really need a map on your homepage? Could you have a map on your Contact Us or Location page instead? If you do need to run a map (and I appreciate it’s a handy touch) then you could instead take a screengrab of a Google Map and then convert that into an optimised image. When the user clicks that image, it will pop open a new window in Google Maps with your location pin-pointed.
Here’s the Google Map on a client’s site – all the components to load this map weight up to 225kb:
Here’s the PNG flat version of the map, optimised to 90kb:
If you have Photoshop, you’re set. Just take a screengrab, paste it into Photoshop, crop it to the right proportions, resize it and then select File > Save for Web and then save as a PNG. JPG files tend to make text fuzzy when you compress them too much, so PNGs are best but if you have a map with no text, JPG might be a better option for the lowest file size.
Configure a CDN (Expert)
The benefits of a CDN are scalability, reliability and performance.
It’s worth noting that the HTML will still come from your web host (so you still need a hosting provider), but the static content will come from the Content Delivery Network. You can read our full what is a CDN guide here.
There are hundreds of CDNs on the market, but some of the popular ones are MaxCDN, Stackpath, Cloudflare. Some hosts also come with a built-in CDN, so it’s worth looking into that if you’re just starting out and yet to choose a host.
We’ve set this task as ‘expert’ status as there complexity of setting up a CDN varies depending on which CDN provider you choose. Some have associated WordPress plugins that help you get up and running but others have no plugins and barely any documentation.
A CDN is a worthwhile investment and you’ll notice a speed improvement instantly.
A final word
Whenever you follow one of the WordPress speed improvements in this guide, remember to retest your site in GTMetrix and record the result. You might find that some of the areas you can improve end up making the site slower but the Page Speed and YSlow scores improve. This could be due to your plugins clashing with any new plugins you install from this guide.
As a general rule, it’s best to run just one WordPress speed optimisation plugin at a time as they can easily conflict with each other.
Good luck, happy speed hunting!
Lead image: ‘Lightning Cat’ by Nishant Gantha