Why is My WordPress Site so Slow to Load?

A Speeding Bullet train

The more the web goes mobile, the more important becomes the speed at which your website pages load.

Speed is definitely king – at least on the web.

Adding a caching plugin to WordPress and using a CDN are both good ways to speed up your page load times, but they will deliver only limited benefits if you do not have the basics right.

So let’s look at the basics first, and then we can touch on caching and CDNs.

Here are some basic factors that slow down your page load times and what to do about them.

Hosting

The quality of the hosting on which your site sits has the biggest impact on the speed with which your site pages load. Hosting is the foundation on which every website is built, and it plays a huge part in defining page load speed, security, stability and consistency.

Saving money by going with cheap or free hosting is a false economy.

A web hosting server roomHosting providers offering free hosting have to make money somehow – so they sell advertising. And the adverts that they sell are then inserted above and below your web pages, whether or not they are relevant to your content.

Also, in order to boost the potential number of page views to advertisers (and, therefore, sell more advertising), they cram as many websites as possible onto each server. This, of course, pushes the server capacity to its limits and that leads to slow page load times and instability of your site.

If your website is an important part of your business, paying for good hosting is worth every penny and more! It will ensure that:

  • Your pages load quickly
  • Your website is stable
  • Your website is running in a secure environment
  • You get top class support when you need it

I wrote an article on my WP Security Basics website that explores this area in more depth – read it here.

Don’t go for free hosting. It’s a false economy and you can get good hosting for a very reasonable price

Your theme

After hosting, your theme probably has the biggest impact on page load times.

This is because the quality of the coding in your theme will define how quickly the browser is able to parse and render your site when the server sends the files across.

And please do not assume that just because you pay for a theme, instead of getting a free one from the WordPress repository, it will be better for page load times (or SEO).

There is absolutely no correlation between paying for a theme and the speed at which your pages load.

Here’s an example:

WordPress theme iconsI was helping a customer some time ago with the theme that she had on her website. She was concerned about the time it took for her pages to load, but she liked the theme’s appearance.

As part of the process of speeding up her website I looked at the plugins that were active on her site, one of which was Woo Commerce.

As she did not have a shop on her site I asked her why Woo Commerce had been installed and activated – to which she replied that she had not installed it.

After checking that she had no plans to put a shop on her site I deactivated Woo Commerce – only to find that the layout of non-shop pages had been changed – and not in a good way!

It turned out that the coding on this theme was so bad that you had to keep Woo Commerce installed and active just to retain the theme’s default layout..!

She had paid good money for that theme from ThemeForest to get a site that loaded slowly

The best approach when choosing a theme is to look for one that has as few ‘additional’ functions as possible built in. ‘None’ would be best!

Themes from ThemeForest and other theme market places will often boast sliders, Woo Commerce (an online shop), page builders and all manner of other functionality built in to the them. But, unless you’re using all that functionality, it’s just code bloat and will slow down your site.

Look for a basic theme in the WordPress repository, with no additional extras, and, if you need to add functionality, do it yourself by choosing and installing good quality plugins.

The number of resources you’re loading from other servers

When your browser loads a web page it’s fetching, from either your server or any number of other servers, all the elements that are defined in the HTML – the code on which the Internet runs – and which make up your page.

HTTP request process flowThese are called HTTP requests, and you need there to be as few of these as possible.

Also, you want as many as possible, if not all, of these HTTP requests to be directed to your server, not other servers.

As soon as you install scripts or tags on your site that rely on code from another server you lose control over how quickly they load. Sometimes those distant servers may not even be available, in which case you’re stuck (depending on the importance of the element your browser is attempting to fetch).

Here’s an example:

If you run Amazon ads on your website Amazon will give you a snippet of code to paste into your page. This code links to the product, delivers a product image to display on your site (the ad) and tells Amazon that anyone clicking the link came from your website.

But the product image that it displays as the ad is fetched from Amazon’s server, not yours.

If you can download the product image and store it on your server, and then manually insert the link containing your affiliate ID to the product on Amazon’s page, you’re no longer dependent on Amazon returning the product image and, as a result, the ad will load a lot more quickly.

In WordPress terms, ‘storing the image on your server’ simply means uploading it to the media gallery, inserting it where you want the ad to appear and adding your affiliate link.

So wherever possible, reduce the number of scripts that are running and download things like images which are being served from other servers, so they can be loaded in the browser from your server.

Also, where you’re loading tracking tags (such as Google Analytics) they should be asynchronous (Google Analytics and Search Console tags are both asynchronous). If you definitely need the tag and it’s not asynchronous then place it in the footer. If it’s not a definite requirement then don’t use it!

Images that are not optimized

This is a well-known drag on speed and you should always make sure your images are optimised as far as possible to the smallest file size, but consistent with an acceptable quality.

There are a number of WordPress plugins that will optimize images for you, but I prefer to prepare my images before uploading them.

Not only does this remove the need for a plugin, but it gives me more control over the balance between optimization and quality.

There’s a site I’ve used for years to optimize my images – you can find it here.

Optimising imagesJust upload your image, select ‘Show all results’, select ‘Same as input type’ next to ‘Convert to’, and click ‘Optimise’.

Several versions of your image, each with an increasing level of optimization, will be displayed.

You can choose the one with the highest amount of optimization consistent with the quality you require and download it to your computer. From there you can upload it to your site.

However you choose to do your optimization, always make sure to optimize every image on every page on your site!

The quality of the plugins you’re using

Contrary to popular opinion, the quality of the plugins you use has more impact on page load speed than the number of plugins on your site.

While you should always keep the number of plugins as low as possible, and remove any that you’re not using, be sure to use well-coded plugins.

WordPress pluginsAs with themes, some plugins are well-coded and some not.

Here’s an example of a poorly coded plugin:

A client wanted a free plugin that showed a timeline of the history of their company.

The only plugin I could find that was both free (at their insistence) and did what they wanted was so badly coded that you could not change the styling even by adding custom CSS.

The only way to change the appearance of the timeline was to edit the core code and, of course, as soon as the plugin was updated the change was over-written.

There were plenty of other problems with the coding as well, but this is indicative of poor coding in a plugin that has a negative impact on the speed at which the site pages load.

So when you’re looking for plugins be sure to carefully study the statistical and review information on the plugins page and use the best one for your need.

After you’ve got the basics right. . .

Those items I’ve covered so far are focused on getting the basics right.

Once you’ve done that then compressing your website code, adding a caching plugin and signing up for a CDN are good ways to further improve your page-load speed.

Deflating (compressing) your web page code

The browser does not need the white spaces that humans need to be able to quickly scan and understand what the code on your site is saying.

So compressing your code by removing all the white space will reduce the size of the files that the browser has to receive and process, thereby speeding up the page-load time.

To do this, you need access to your .HTACCESS file, either via FTP or your web hosting file manager.

Do be careful when editing your .HTACCESS file – getting it wrong will crash your website!

With that warning ringing in your ears, here’s how to compress your web page code:

Access your .HTACCESS file (it will be in the same directory as all the other WordPress files) and paste in this code:

# compress text, html, javascript, css, xml: #
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# End compression #

# Or, compress certain file types by extension: #
<Files *.html>
SetOutputFilter DEFLATE
</Files>

What that code does is to compress the code of your system files, making them as small as possible which will speed up your page-load time.

Install a caching plugin

A caching plugin basically takes parts of your web page and makes a copy of them to store on the server. It does not copy everything on the page, only the things that don’t change, such as images and system files.

But, none-the-less, this reduces the number of HTTP requests that are required by the browser to load your page and, therefore, improves the page-load time.

There are a number of WordPress caching plugins available – just do a search for ‘Cache’ or ‘Caching’ in your  Plugins > Add New screen .

As I said earlier, be sure to carefully check the statistics and comments for each of the caching plugins to make sure you install one that:

  • Has good reviews and a strong 5 stars
  • Has at least 20,000 installations
  • Has as few outstanding support queries as possible

Caching plugins will be more effective if you have taken care of the basics that I discussed earlier, so be sure to attend to those first.

Sign up for a CDN

A CDN is a Content Distribution Network.

A CDN service provider has servers located in many locations around the globe and, once you sign up with them, they will store a copy of your website on each of these servers.

What that means is that if your site is hosted in the US and someone living in Australia visits, the Australian visitor will be accessing the copy that’s sitting on the CDN’s server in Australia, rather than the origin server in the US.

Because the site files only have to travel from one part of Australia to another, rather than from the origin server in the US, the page loads more quickly.

This diagram illustrates:

A CDN network

There are a number of CDN service providers, most of which offer a free plan.

As with anything, though, you get what you pay for and opting for even the lowest cost paid plan will give you much improved performance and greater security.

As with a caching plugin, taking care of the basics first will result in you getting a better return from the CDN

In closing. . .

Speeding up your page-load times is a process, I’m afraid – there are no silver bullets.

But, if you work through the items I’ve covered here, you should see some significant improvements in the speed with which your web pages load.

Always remember, too, that you need to keep these points in mind consistently. It’s all too easy to assume that improving your page load times is a one-and-done exercise, but it’s not.

It’s all too easy to undo these optimisation steps over time as you add content and make changes to your site.

If you have any questions do please leave them in the comments below – I’ll answer them as quickly as I can.

Martin Malden

Martin Malden
Owner – WealthyDragon

P.S. Learn how to earn an income online:

The Jaaxy keyword research tool will give you that competitive edge

Comments on this entry are closed.

  • Norman Richards 2 April, 2019, 7:29 pm

    Load speed is so important and it makes the big difference in the amount of traffic you get to your site.

    You may have chosen a good niche along with having engaging posts where your website is professionally done, but if the load speed sucks this can affect traffic which will impact the bottom line.

    Thanks so much for this very informative post. Much food for thought!

    • Martin Malden 2 April, 2019, 7:41 pm

      Hi Norman,

      It absolutely amazes me how slowly some modern sites load and I lose patience very quickly.

      If there’s nothing there after 5 seconds I’m usually gone, unless it’s a government site or something similar where I have to wait. 🙂 (And then I’m usually waiting for ages!).

      Cheers,

      Martin.

  • Colette Pepperell 2 April, 2019, 10:37 pm

    This was very helpful to read because site speed is critical.

    We always hear about all the great plugins but how many is too many? It gets so confusing!

    You have brought up many points that we will consider going forward with our website.

    Thank you,

    Colette

    • Martin Malden 3 April, 2019, 8:06 am

      Hi Colette,

      The number of plugins on your site should be as low as possible while still enabling your website to do its job. Unfortunately, there is no fixed threshold because it depends on the purpose of your site.

      Plugins can also be a double edged sword, because they can be abandoned or sold if the author’s circumstances change, so you need to keep a watchful eye out for any changes.

      This is one reason why I prefer to use premium (paid for) plugins or free plugins where there is a premium option. These plugins are more likely to be properly maintained and less likely to be abandoned!

      I wrote a post on my agency site about the number of plugins you should consider installing – it may help, and you can read it here.

      Cheers,

      Martin.