How to Speed Up Your WordPress Website in 20 Minutes

Everyone knows that page speed is important. It’s a confirmed Google ranking factor on desktop and mobile, impacts user experience, and can have a direct effect on your bottom line.

But slow WordPress websites are a common issue.

Here’s the mobile score for a page of mine in PageSpeed Insights.

Before optimization.

If we run the entire website through Ahrefs’ Site Audit—which shows page load time for all pages—we see that this isn’t the only slow-loading page either. None of them load massively fast, with an average load time of 570ms.

Before optimization.

Now here’s that same page after around 20 minutes of page speed optimization:

After optimization.

And the rest of the pages in Site Audit:

After optimization.

The difference is night and day. The score from PageSpeed Insights is near-perfect, and every page loads pretty fast.

In this guide, I’ll show you exactly how I did this in a few simple and easy steps.

  1. Remove unused plugins
  2. Switch DNS providers to Cloudflare
  3. Install a caching plugin
  4. Minify your code
  5. Combine CSS and JavaScript files
  6. Eliminate render-blocking resources
  7. Lazy-load images and videos
  8. Optimize Google Fonts
  9. Enable preloading
  10. Use a CDN
  11. Optimize your images

important

Many of the recommended optimizations below use WPRocket, a paid plugin for speeding up your WordPress website. I’ve listed free alternatives where possible, but it’s important to note that plugins can sometimes conflict with each other and cause issues. You should always test how they affect your site in a staging environment before pushing any changes to your live site. Learn how to set up a staging site here.

Cloudflare.

To do this, sign up for a free Cloudflare account. Click “Add a site,” enter your domain name, and click the button.

5 cloudflare dns

Select the free plan, then click “Confirm plan.”

Cloudflare will now give you a chance to review your DNS settings before continuing. If there are no warnings, it’s usually safe to continue.

Now all that’s left to do is to swap your nameservers with your domain registrar. The way you do this varies between registrars, so don’t hesitate to ask their support if you’re unsure how to do it.

Here’s the process if you’re using Google Domains:

6 nameservers

WP Rocket makes it simple to enable caching. Just buy, install, and activate it. Basic caching (server and browser) is on by default. If your site is responsive, head to the cache settings and check the box to enable caching for mobile devices, too.

7 wp rocket caching

Looking for a free option? Try W3 Total Cache.

Autoptimize and do the same.

Just know that you should always test how this affects your website before deploying live. Minifying can often lead to broken code, especially when it comes to Javascript.

Key CDN’s tester.

9 http1 http2

If HTTP/2 isn’t supported, it’s worth combining CSS and JavaScript files.

To do this in WPRocket, tick the checkboxes to “Combine JavaScript files” and “Combine CSS files” in the settings.

10 wprocket combine css

If you’re using Autoptimize, there are two checkboxes to “aggregate” files. Just know these can sometimes ‘break’ things on your site, so it’s worth double-checking that everything still looks and functions the same once enabled. And remember to clear the cache beforehand and check for changes in an incognito window. Otherwise, the changes might not be reflected in what you see.

Autoptimize and Async JavaScript.

In the settings for Autoptimize, check the box to “Inline and Defer CSS.” Then, in the settings for Async JavaScript, hit “Enable Async JavaScript.

If you previously saw the “eliminate render-blocking resources” issue in PageSpeed Insights, this will usually fix that problem.

12 render blocking pagespeed insights

enabled by default, but not for video.

If you’re using WPRocket, solve this by ticking the “Enable for iframes and videos” box under LazyLoad settings.

13 lazy loading videos

If you’re not using WPRocket, the free Lazy Load for Videos plugin does much the same thing.

Swap Google Fonts Display is a good starting point.

That tells browsers to prioritize the CSS file over the JavaScript file, regardless of hierarchy.You can add preload attributes manually by editing the code, but that can get messy and confusing unless you know what you’re doing. It’s much easier just to install WPRocket, which does this automatically out of the box.

Step 10. Use a CDN

Content delivery networks (CDN) are groups of servers distributed all over the world. Each of these stores a copy of your website so it’s quicker for users to connect when requesting web pages.

For example, let’s say your web host’s server is in the UK. If someone visits your site from the US and you’re not using a CDN, the connection between their device and your server will be slow. If someone visits from the US and you use a CDN, their device will connect to the closest server, which helps things connect faster.

There are lots of CNS providers, so all you need to do is choose one, enable it in WPRocket, and enter the CNAME.

14 wprocket cdn

Shortpixel. Just install it, activate it, go to the settings, enter your API key, click “Save and Go to Bulk Process, then click “Restart optimizing.” 

15 shortpixel

If you find that these are too low quality, head to the settings, and change the compression type to glossy or lossless.

16 shortpixel compression

The results

Let’s look at how these optimizations impacted our page speed according to a couple of popular tools.

Here are the before and after stats for my post in Google’s PageSpeed Insights:

1 pagespeed insights slow

Before optimization.

3 pagespeed insights fast

After optimization.

And here’s the same from GTMetrix:

18 gtmetrix before

Before optimization.

17 gtmetrix after

After optimization.

You can see that the page previously fully loaded in 5.9 seconds with a 1.89mb page size and 67 requests. After the optimizations, all three metrics are down. The page size is 695 kilobytes, fully loaded time is 4 seconds, and the number of requests has shrunk by nearly 50%.

If we check all pages on the website in Ahrefs’ Site Audit, we see around a 40% improvement in average and 95th percentile load time.

4 site audit fast

Final thoughts

Everything above worked well for my site, and it’s worked well for other sites too. However, it’s important to remember that every WordPress configuration is different. You might have more plugins, a clunkier theme, slower hosting, or more third-party tracking scripts, all of which slow your website down.

If your page speed could still do with some improvements after making these optimizations, then it’s likely that you need custom work done on your site. So it’s worth hiring a developer or page speed expert to take a look at things a bit more closely.

Or, if you want more details on specific issues, check out our complete page speed guide.

Did we miss anything important from this guide? Ping me on Twitter.

Posted by Contributor