18 Ways to Speed Up Your WordPress Site (A Guide for 2020)

Share this article

How to Speed Up Your WordPress Site

How to speed up your WordPress site is a hot topic nowadays, as it’s a well-known fact that having a fast website will help you keep your site visitors on-board, increase your page views and improve your SEO.

This article breaks down how to speed up your WordPress site using a number of different methods that have been proven to boost performance.

These are tried and tested methods that I’ve used myself and I can tell you from first-hand experience that they really do make a difference.

In this Article

Introduction

How to Speed Up Your WordPress Site

  1. Choose a Better WordPress Hosting Provider
  2. Use a Lightweight WordPress Theme
  3. Scale Your Images
  4. Compress Your Images
  5. Serve Your Images in Next-Gen Formats
  6. Lazy Load Your Images
  7. Use a Content Delivery Network (CDN)
  8. Use a Caching Plugin
  9. Minify HTML, CSS and JavaScript
  10. Enable GZIP Compression
  11. Clean Up Your WordPress Database
  12. Deactivate or Uninstall Unnecessary Plugins
  13. Minimise External Scripts
  14. Disable WordPress Pingbacks and Trackbacks
  15. Paginate Your Comments
  16. Disable Hotlinking
  17. Remove Query Strings
  18. Use the Latest PHP Version

Why Should I Speed Up My WordPress Site?

There are a few good reasons why you should speed up your WordPress site:

  • Search Engines like Google think in terms of getting the searcher the information they’re looking for as fast as possible, so they usually reward faster websites with higher rankings.
  • Studies show that if your site takes longer than 2 seconds to load, almost half of your visitors will ‘bounce’ from your site.
  • Online buyers are the most impatient and expect a page to load within a second. If you run an eCommerce site with WordPress, you should speed it up to increase your sales.

How to Test the Speed of Your WordPress Site

There’s many different tools out there that you can use to test the speed of your WordPress site. Personally, I recommend:

Bear in mind you will get different results from all of these tools, and the results will differ between pages on your site. However, they’re a great way to get an overall idea of how to speed up your WordPress site.

Backup Your Site Before Optimising

Before making changes, you should create a backup of your site in case anything goes wrong and you need to revert to the original version.

There’s a number of plugins that can help with this, but I recommend UpdraftPlus.

To backup your site using UpdraftPlus, simply install and activate the plugin, browse to UpdraftsPlus Backups under the Settings menu in your WordPress admin panel and click the Backup Now button.

Backup your WordPress site with UpdraftPlus to improve your site loading speed

A popup will appear. Check the options to Include the database in the backup and Include any files in the backup. Now click Backup Now.

Check the relevant options when backing up your WordPress site

Great, you’ve created a backup! If your site becomes corrupted or ever gets hacked, you can restore your site from this backup.

It’s a good idea to back your site up regularly so that if you do need to use one, you can restore a recent backup rather than rolling back to a very old version.

1. Choose a Better WordPress Hosting Provider

One of the major factors that affects the loading speed of your WordPress site is your hosting provider.

HostGator offers very reasonable hosting packages and are well known in the industry for their speed, security, 99.9% uptime guarantee, 24/7 support and 1-click WordPress installation. They also offer a free site migration service, making it easy to transfer your site.

If you are a larger business or eCommerce site, consider using Managed WordPress hosting over a shared hosting package. For more information about hosting providers, check out this article on Choosing the Best WordPress Hosting.

2. Use a lightweight WordPress Theme

You might like the look of a WordPress theme that has lots of visual elements, sliders, social icons, and other bells and whistles but remember that the more elements and images your site has, the more weight it adds to your pages, decreasing the loading speed and increasing the number of resources your server has to use to deliver the page.

Using a lightweight WordPress theme might mean sacrificing some of that visual goodness, but you’ll see faster loading speed across the board, and your SEO will be rewarded in return.

There are a number of lightweight WordPress themes out there. I recommend having a look for a suitable theme on the Envato Marketplace.

While using a lightweight theme is a good idea, your site content will look bare without imagery. That’s not an issue as long you deal with your images appropriately…

3. Scale Your images

Scale your images to speed up your WordPress site

WordPress comes with image scaling capabilities built-in.

As shown in the screenshot, when you add an image to a page, you can choose to use thumbnail, medium, large or full size images.

This is found in the right-hand sidebar under the Image Settings tab when you have an image selected.

You should always use the smallest option that you can get away with so that your site visitors aren’t having to download unnecessarily large images, making them download faster.

4. Compress Your Images

You should also compress your images. Luckily, there are WordPress plugins out there that can help us with that task.

I recommend Smush, it allows you to compress images in your media library in bulk, and it’ll automatically compress new images when they’re uploaded.

Smaller image file sizes will mean your site’s visitors won’t have to wait so long for the images to download.

5. Serve Your Images in Next-Gen Formats

This one often trips people up when they notice it flagged up on tools like PageSpeed Insights. However, it’s a doddle with WordPress.

You may or may not have heard of the WebP image format; a relatively new image format that is designed specifically for the web.

It’s designed to deliver images with good quality, but with much smaller file sizes than PNG or JPG formats, and much faster loading speed. It supports transparency too, so no worries about those transparent PNGs.

Using the plugin WebP Express, you can set your site to serve images in the WebP format (as long as your server supports it).

By enabling this, you will pass the PageSpeed Insights test for serving images in next-gen formats, and your images will load even quicker.

6. Lazy Load Your Images

While compressing, scaling and serving your images in next-gen formats might seem like it’s enough, why should your site visitors have to download images that they aren’t looking at yet?

By lazy loading your images, they will only be downloaded once they are in view, saving time on the initial page load.

To enable lazy-loading on your site, I recommend the plugin A3 Lazy Load.

The set up is simple, just install and activate the plugin. You can also set options like how soon the images should load, whether they should display a loading wheel or fade in, and so on, which is a nice touch from the plugin developer.

7. Use a Content Delivery Network (CDN)

Using a CDN is a great way to speed up your WordPress site and add extra security.

A CDN stores a copy of your website’s files on a network of servers all around the world, meaning the physical distance between your server and the visitor’s computer is reduced, allowing your site to load more quickly.

I recommend using Cloudflare, because it offers a free CDN service, and is fairly easy to set up as long as you know how to change your domain’s nameservers. It also offers a number of handy speed settings.

For more information on how to connect your site to Cloudflare, have a look at this article on their website.

8. Use a Caching Plugin

There are a number of WordPress caching plugins available which make the otherwise complex task of adding caching to your site relatively easy. My recommendation is WP Fastest Cache.

The setup is fairly straightforward, and you can even connect it to Cloudflare.

The options I use within WP Fastest Cache are as pictured below, but you may want to use different options depending on how your site is built or just because of your preference.

WP Fastest Cache Options settings to speed up your WordPress site

To connect WP Fastest Cache with Cloudflare, just browse to the CDN tab, and enter your Cloudflare email address and API key (you can get this from your Cloudflare dashboard under My Account > API Tokens).

Wp Fastest Cache Connection to Cloudflare CDN

Cheekily, integrating Cloudflare with WP Fastest Cache will disable a couple of options within Cloudflare. Personally I think it’s best to re-enable these options afterwards.

The options it disables are the auto-minify and Rocket loader settings. These can be found under Speed > Optimization from within your Cloudflare dashboard.

9. Minify HTML, CSS and JavaScript

You can auto-minify these scripts with Cloudflare, and WP Fastest Cache comes with the option to minify your site’s HTML and CSS and combine the CSS and JS. Personally I like to have all of these options enabled.

Cloudflare auto minification options
Cloudflare Minification Settings
Source code minification and combination in WP Fastest Cache
WP Fastest Cache Minification Settings

It’s a good idea to do this because it compresses the files down to a smaller size and allows your visitors to download them more quickly, resulting in a faster loading speed.

Bear in mind that minifying the HTML, CSS and JavaScript can break things on your site, so have a good look once you’ve done this to make sure everything’s still working as it should.

You can also perform some manual tweaks to your WordPress theme if you know your way around.

10. Enable GZIP Compression

You can also enable GZIP compression with WP Fastest Cache.

This will further compress your site’s files, reducing download times and improving the loading speed of your WordPress site.

You can also enable this manually by adding the following code to your .htaccess file:

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

11. Clean Up Your WordPress Database

Reducing the size of your database means the server has less data to look through when serving your content, which will speed up your WordPress site.

There are a number of plugins available to do this but I recommend WP-Optimize.

With WP-Optimize you can not only clean up and optimise your database with the click of a button, but you can also “set it and forget it” by creating a scheduled clean up that will run automatically.

12. Deactivate or Uninstall Unnecessary Plugins

Keeping unused or unwanted plugins on your site can add weight to your pages, which will be loading extra scripts that aren’t even being used.

It’s best to shed that extra weight where you can by deactivating or uninstalling those unnecessary plugins and even looking for other ways to perform some of the tasks that plugins might be doing.

13. Minimise External Scripts

Loading external scripts will increase the loading time of your site, so it’s best to keep them to a minimum and stick with the essentials like Google Analytics. Stripping out any unnecessary external scripts will speed up your WordPress site.

14. Disable WordPress Pingbacks and Trackbacks

Pingbacks and Trackbacks are part of the WordPress core functionality. They’ll alert you whenever a link to your website is created on another site.

That might sound useful, but there are other services like Google Webmaster tools that will do the same job without creating extra strain on your server.

Pingbacks and Trackbacks can also be used to DDOS a website, so it’s a good idea to disable it for security reasons too.

To disable Pingbacks and Trackbacks, browse to Settings > Discussion from your WordPress admin panel, uncheck the box that says Allow link notifications from other blogs (pingbacks and trackbacks) on new posts and click Save Settings.

Disable pingbacks and trackbacks to improve your WordPress site's loading speed and security

15. Paginate Your Comments

If you get a lot of comments on your blog posts or products, that’s a great sign that you are creating engaging content.

However, it’s a good idea to split them into pages so that your server isn’t having to load hundreds of comments at once.

To do this, go to Settings > Discussion from your WordPress admin panel, and check the option to Break comments into pages. It’s up to you how many comments you want to show per page, but I’d recommend not going above 50.

Paginate comments to speed up your WordPress site

16. Disable Hotlinking

Hotlinking is when other sites directly embed your content (usually images). Every time someone visits a page where your image is embedded, it has to load from your server, slowing your website down.

To disable it, install and activate my very own plugin, WordWhippet, browse to WordWhippet from your WordPress admin panel, and check the Disable Hotlinking box.

Facebook, Twitter, Instagram and Google are allowed by default, and you can add any other sites that you want to make an exception for.

You can also disable hotlinking by adding the following code to your .htaccess file:

# Disable hotlinking of images (allow Facebook, Twitter, Instagram and Google)
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?twitter.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?instagram.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L] 

17. Remove Query Strings

Scripts and styles on your WordPress site may use query strings with version numbers, preventing them from being cached by the browser.

This is useful when developing a site because it means that changes to your scripts or styles will take effect as soon as they’re updated, but once your site is live it’s a good idea to remove the query strings so that these scripts and styles can be cached by the browser, improving loading times.

You can remove query strings using WordWhippet, by checking the Remove query strings option, or you can add the following code to your functions.php:

function remove_query_strings() {
   if(!is_admin()) {
       add_filter('script_loader_src', 'remove_query_strings_split', 15);
       add_filter('style_loader_src', 'remove_query_strings_split', 15);
   }
}

function remove_query_strings_split($src){
   $output = preg_split("/(&amp;ver|\?ver)/", $src);
   return $output[0];
}
add_action('init', 'remove_query_strings');

18. Use the Latest PHP Version

PHP 7 has a huge performance boost over its predecessors, offering up to 2 times more speed.

Most good WordPress hosting providers will use the latest stable version of PHP on their servers but it’s worth checking what version you are using.

To do this, you can use the Version Info plugin. Once installed and activated, it’ll display your PHP version in the footer of your WordPress admin panel.

If you’re not running at least PHP version 7, you should ask your hosting to provider to upgrade it for you. If your provider doesn’t offer the latest version of PHP, it might be time to look at choosing a new WordPress hosting company.


Share this article

Leave a Reply

Your email address will not be published.Required fields are marked *

web design & development blog email notification updates

Keep up to date with the latest web design tips, tricks, trends and more