The speed of a website is a big deal. It has a direct influence on a visitor’s chances of returning, on conversion rates, on customer satisfaction levels, and even on your website’s ranking in search engines like Google.
In short, your website must be fast! But how fast? Well, in general, pages should be loaded in less than three seconds, but in reality, faster is better (ideally one or two seconds).
WordPress is a well-managed and optimized system: when problems arise, they are generally due to the fact that almost nobody uses a vanilla installation of WordPress. To get the results you need, chances are you’re using dozens of plugins, custom code, or third-party themes, all of which are potentially capable of worsening the speed of your WordPress site.
In this article, we will examine the root causes of these reductions and analyze what can be done to resolve any problems and restore the speed of the site.
Summary
Four factors that influence the speed of a WordPress site
- Ping
- Quality of hosting
- Code quality
- Website inquiries
How to measure loading times?
What is a good loading time?
How to reduce loading times and speed up a WordPress site?
Choose a fast host.
Update everything (especially PHP).
Use a CDN.
Use page cache (server level if possible).
Optimize your images.
Review your plugins.
Enable Gzip compression.
Minimize and concatenate files.
Development activities.
Insert the scripts into the footer.
Upload important content first.
Optimize your database.
Conclusion.
Four factors that influence the speed of a WordPress site.
There are several factors that determine the speed of a WordPress website, here are the ones we will see in more detail:
- Ping
- Quality of hosting
- Code quality
- Website inquiries
1. Ping
Ping is essentially the time it takes a query to get from your computer (or your visitors’ computer ) to your website’s server. Ping is measured in milliseconds, and although it may seem little these milliseconds add up quickly. If your website has a lot of requests, even a 10ms ping might add up to a second or more.
Obviously you cannot ask users to physically get closer to your servers, but you can use a content distribution network (CDN) to reduce ping on average. Below we will talk more about CDN services.
2. Quality of hosting
Hosting is probably the most important factor in the speed of your site. Not only does it affect the user experience by providing faster cache and more powerful servers, but with the right infrastructure, you will be better protected against waves of traffic and the effects of poor code quality can also be mitigated.
Therefore, finding a good host should be a priority. As a general rule, it’s worth investing a little extra for a premium hosting service, especially if your business relies on the speed and uptime of the website.
3. Code quality
Code quality affects website speed in several ways: incorrect code processing takes longer; unoptimized code may require much more memory, taking longer to download.
Not to mention the snowball effect linked to hard-to-maintain code: the more developers add code to your site in different styles, using different methodologies, the more it will begin to degrade, aggravating the problems described above.
The problem is that unless you are an experienced developer, it is difficult to determine the quality of the code you are using. However, there are some things that are easier to control than others, such as choosing reliable plugins, as we will see later.
4. Website inquiries
The number of requests made by your website is related to the quality of the code, but it is worth highlighting it because you can control it to some extent. Every time your site loads a resource – an image, a video, a script (a tracking code, for example) and other things – a request is made. Each separate request takes time, which reduces the speed of your site, but there are some techniques for reducing the number of requests for your site – we’ll take a look at some of them below.
How to measure loading times
Before you understand how to reduce loading times, you need to know how to measure them. GTmetrix is an excellent tool, which allows you to measure the performance of your site and obtain all types of information and solutions that can be used for free.
Other interesting options include Pingdom and WebPageTest , both of which are similar services.
When performing performance tests, it is important to consider a few things:
Variability: make sure you run multiple tests at different times of the day, so you get a complete picture of your site’s loading times. Individual tests may vary, so you need to run multiple tests if you want accurate data.
Test location: try to choose a test location close to your target audience, so you can accurately gain their experience. Or, if you have a global audience, be sure to try from different locations around the world to see how different visitors will experience your site.
Devices: More than 50% of Internet traffic occurs today on mobile devices, but most people continue to test desktop load times. However, there are some important differences between the devices. For example, cheap smartphones take longer to process JavaScript, which means that a heavy JavaScript website can load much more slowly on mobile devices.
GTmetrix and WebPageTest: both allow you to edit test locations, devices and other variables.
What is a good loading time?
First, it is important to remember that there is no single page load time for your site. Beyond the optimizations made, the loading speed of the site depends on other factors, such as the position of a visitor, the device (for example desktop vs smartphone) and the connection speed (for example 3G vs a fast wired connection).
Furthermore, a good loading time on the desktop is not necessarily equal to a good loading time on the mobile phone, although the data is similar.
For mobile devices, Google recommends trying to keep loading times under three seconds . On top of that, and the probability of your visitor bouncing away almost doubles.
It’s hard to find similar data for desktop visitors, but you’ll see a similar jump of about three seconds even on desktop devices, at least according to this Pingdom data . However, the jump in bounce rate isn’t as great as it is for mobile visitors, which suggests that desktop visitors are a little more forgiving.
In general, however, you should have a maximum of three seconds.
How to reduce loading times and speed up a WordPress site
While some of these tips may seem a little technical, you will be able to perform all the tips in this first section without needing any special technical knowledge. Most of them involve a smart choice and the installation of WordPress plugins where necessary.
Choose a fast host
We have already mentioned the importance of a good host. A good host not only offers advanced services, such as backup, site monitoring and easy addition of new sites, but also puts in place optimizations to make sure your site loads quickly.
If you want fast WordPress loading times, the best choice is to choose a managed host optimized specifically for WordPress performance.
One thing we would like to warn against is the use of managed WordPress hosting services from companies that also focus on other forms of hosting. These services are generally inexpensive and are not specific to WordPress, just a reissue of their shared plans or existing VPS. This does not necessarily mean that they are not performing, but companies that specialize in WordPress services are much better at this type of thing.
Update everything (especially PHP)
First of all, be sure to always use the latest version of WordPress. Since version 3.7, WordPress has had automatic updates for minor versions and security updates. When a new update comes out, you will receive an alert in the administration. Do not postpone it as a chore for later: it takes less than a minute, it will increase the security of your website and probably speed.
Make sure that your plugins and themes are also updated to the latest versions with fewer bugs, more updated, safer and faster.
So much for WordPress, but don’t forget your servers, especially your version of PHP . PHP is the basic language in which WordPress is written and the difference in speed between the latest version of PHP and previous versions is spectacular. According to Kinsta’s WordPress PHP benchmarks , for example, PHP 7.4 processes more than three times the number of requests per second compared to PHP 5.6.
Despite the huge difference, over 25% of WordPress sites unfortunately still use PHP 5.6 or earlier .
High-end hosts will manage this update for you, or you may be able to set which version of PHP your server uses from your hosting dashboard. If you can’t find any mention of this, try contacting your host’s support.
Use a CDN
I have already talked about CDN services in relation to lowering pings. A CDN is a distribution network that provides content to your visitors from a geographically closest location. If I serve an image through a CDN, users in the United States could receive the image through a datacenter in Texas, while Europeans could receive it through a datacenter in Germany.
Reducing the distance that data has to travel reduces pings and transfer times and reduces stress on your site’s server, as your static content is now distributed worldwide.
An easy way to get started with a CDN is to use the Site Accelerator feature in the free Jetpack plugin . This will speed up the loading of your images and static files, such as CSS and JavaScript.
Alternatively, you can also use the free Cloudflare service, although it requires a little more configuration because you have to change the nameservers of your domain.
You can also take advantage of a range of premium CDN services such as:
- KeyCDN
- StackPath ( acquired MaxCDN )
- Amazon CloudFront
- BunnyCDN
- Fastly
Many premium managed WordPress hosts also provide CDN services in their packages at no additional cost. This is another reason for using managed WordPress hosting.
Use page cache (server level if possible)
When you offer a page to your visitors, the following occurs: the PHP code is executed and processed on the server, generating the HTML code that is sent to the user. The resulting HTML is almost always the same, but is still processed every time.
Take a blog post, for example. It doesn’t change unless it is updated, but the PHP code is still processed every time.
The cache saves the server valuable time by “saving” the result of the processing operation. The code is executed and processed and the resulting HTML code is stored in the cache. For subsequent visitors, the processing is completely ignored and they receive the saved HTML version.
Basically, your server needs to do less work to deliver the content of your site to each visitor.
This not only speeds up your WordPress site, but can be of great help in managing traffic waves, since the server doesn’t need to process every single request.
The best way to implement caching is to choose a managed WordPress host that implements server-level caching. This way, your server doesn’t even need to load WordPress to serve the cache page.
If this is not a viable option, you can also add caching with a WordPress plugin. This isn’t quite as good because the server will still need to load the WordPress application before delivering the cached page, but it can still offer a huge improvement.
Here are three of the best cache plugins:
- WP Rocket (our review )
- WP Super Cache
- WP Fastest Cache
Note: Only one cache plugin is required and a cache plugin is not required if the host has already implemented server-level caching.
Optimize your images
On average , images represent around 50% of the size of a web page. So, if you reduce your images by optimizing them , you can make a big improvement in the loading times of the page of your site.
There are two steps to optimize your images:
Resizing : adjust the actual image size according to your needs. For example, if the content area of the theme is only 800px wide, you should use a maximum of images with a width of ~ 1,600px ( you want to double the width of the content area to allow for screens Retina ).
Compression : allows you to reduce the file size without loss of quality ( lossless compression ) or with a loss of quality, often unnoticeable ( lossy compression ).
If it fits your workflow, you can optimize your images before uploading them to WordPress using Photoshop- like software . All image editors let you choose JPEG quality, so use the lowest setting possible. In many cases, you won’t notice the difference between 100% and 60% of the quality, but the file size may be halved (or more).
If you want a more practical solution, there are also many plugins that can automatically resize and compress images as you upload them to WordPress. ShortPixel , Imagify and EWW Image Optimizer are three good options that have limited free plans. Smush is another quality option with an unlimited free plan, but allows you to use lossless compression only if you sign up for WPMU DEV .
Review your plugins
If you have a very slow site, reviewing your plugins could be one of the best moves you make. I recommend reviewing your plugins list twice. At your first review, identify the plugins you don’t use or don’t need, disable them and then delete them.
Once you’ve removed all the unnecessary plugins, you’ll need to check the ones that remain to see if there’s room for improvement. Make sure each plugin is the best available: there are thousands of plugins in the repository, so choose the ones that are most reliable, tested and of high quality.
Read Also: Website Development services
You should aim to have as few plugins as possible, since by optimizing the use of plugins * you will reduce the number of requests for your site, further increasing the speed.
* Using multiple plugins doesn’t automatically slow down your site because it depends on what each plugin actually does and its code. But unless you have the knowledge to analyze a plugin’s performance on its own, it’s best to stick to the rough rule that more plugins mean a slower website .
Enable Gzip compression
The size of the web pages can greatly contribute to the download speed. By using gzip to compress the website (it is very similar to using zip archives), it is possible to reduce the page size and therefore the time needed to recover it. On average, gzip can reduce file sizes by around 70%.
Many WordPress performance / cache plugins already have a feature to enable gzip compression including WP Rocket , WP Super Cache and WP Fastest Cache . There is also a dedicated plugin called Enable Gzip Compression which focuses entirely on gzip compression.
Alternatively, you can enable it manually by editing your .htaccess file.
Minimize and concatenate files
Concatenating (merging) files helps reduce the number of requests a site makes. If your site contains ten JavaScript files and ten CSS files, it is generating 20 requests. If you merge all your JavaScript files into a single file, though (and do the same for your CSS), you will reduce your requests to two, which will save you a lot of loading time.
File minification is another practical way to reduce file size. The code was written to be read by humans, but machines don’t need all those extra spaces and legible variable names. Minification eliminates everything that is needed only for readability, such as spaces, line breaks and comments.
Some WordPress cache / performance plugins include built-in tools for this. For example, WP Rocket allows you to perform both minification and concatenation.
If you already have a caching solution (or your host implements caching), you can also use the free Autoptimize plugin to minimize and chain your files.
Development activities
As a website owner / user, there is not much else you can do to speed up your site. Many fundamental “flaws” are committed in the code and there isn’t much you can do about it – unless you’re willing to get your hands dirty! Without getting into the heart of the matter, here are the most common problems you will encounter and how to solve them.
Insert the scripts into the footer
Script loading takes up valuable requests and bandwidth. While some need to be loaded into the header (the part of the website that is loaded first), most will work perfectly if loaded into the footer: the part of the site that loads last. When the browser loads the footer of your website, it will have already loaded your content, so that the visitor can start reading while the scripts in the footer are loaded.
The solution is to move as far as possible on the footer. In WordPress, you can do this using the wp_enqueue_script () function – take a look at the linked documentation for more details.
If you don’t want to dig into the code, you can also use the free Async Javascript plugin to at least postpone the loading of JavaScript on your site.
Upload important content first
The same kind of logic can be applied to the structure of the content. If the sidebar is loaded before the content and something goes wrong, it will block the whole site. If it loads after the content, the site may crash, but the main content will be loaded at that point.
It then structures the code in such a way as to allow the loading of primary content as soon as possible, so if something goes wrong users have something to look at – and they might not even notice the problems.
Optimize your database
Over time, any database will deteriorate. The worse your code is, the faster it will happen. Fortunately, MySQL has some excellent built-in tools to fix these problems. Large databases consume more RAM and slow down queries, which leads to longer processing times, which can add up to ten seconds of load time!
Conclusion
As you can see, there is a lot you can do to speed up your WordPress site! Some methods are only suitable for developers (or for the more adventurous), but there are a lot of simple changes that you can perform as a normal user to increase the speed of your WordPress site, in particular with the help of some free plugins or affordable.
Read Also: WordPress Development Services
If you choose quality hosting, use the plugins intelligently and apply some basic optimizations ( such as image compression and the implementation of caching pages ), you should have a WordPress website that can load in less than three seconds.