How To Make WordPress Faster – Much Faster! A Simple Guide!
- 3 Comments
Website speed is a big deal. It has a direct influence on the chances of a visitor returning, conversion rates, customer satisfaction levels and even on your website’s ranking in search engines such as Google. In short, your website needs to be fast! How fast? Well, generally speaking, pages should be loading in less than three seconds, but, really, the faster the better (ideally more like one to two seconds).
WordPress is a well-maintained and highly streamlined system — when issues do arise, they’re generally down to the fact that hardly anyone uses a vanilla WordPress installation. To get the results you need, it’s likely you’re using scores of plugins, custom code or third-party themes — all of which have the potential to chip away at your site’s speed.
In this article, we’ll go through the root causes of these decreases, and look at what you can do to solve any issues and get your site back up to speed.
Four Factors That Affect WordPress Site Speed
There are a few factors that determine the speed of a website — here are the ones we’ll look at in more detail:
- Hosting quality
- Code quality
- Website requests
The ping is essentially the time it takes for a query from your computer (or your visitors’ computers) to get to your website’s server. This is measured in milliseconds, which may seem low, but these milliseconds add up quickly. If your website has lots of requests, even a 10ms ping could add up to a whole second or more.
You obviously can’t ask users to move closer to your servers, but you can use a content delivery network (CDN) to lower pings on average. We’ll talk more about CDN services below.
2. Hosting Quality
Hosting is probably the most important factor in your site’s speed. It not only affects user experience by providing faster caching and more powerful servers, but, with the proper infrastructure, you’ll be better protected against traffic surges, while the effects of lower code quality can also be mitigated.
Therefore, finding a good host should be your top priority. We have numerous articles and guides on hosting here at WinningWP — take a look at our guide to the best WordPress hosting services and our articles on hosting.
As a general rule, it’s worth paying a little extra for a premium hosting service — especially if your business relies on your website’s speed and uptime.
3. Code Quality
Code quality affects site speed in numerous ways: Bad code takes longer to process; unoptimized code may be a lot more memory-intensive, or simply larger, taking more time to download. That’s not to mention the snowball effect that’s tied to hard-to-maintain code — as more and more developers add more and more to your code in different styles, using different methodologies, it’ll start to degrade, compounding all of the issues above.
The problem is, unless you’re a seasoned developer, it’s difficult to determine the quality of the code you’re using. There are a few things that are easier to control than others, though, such as choosing reliable plugins, which we’ll look at later on.
4. Website Requests
The number of requests your website makes is related to code quality, but it’s worth highlighting because you can control it to a certain extent. Whenever your site loads a resource — an image, a video, a script (a tracking code, for example) and a few other things — a request is made. Each separate request takes time, which decreases your site’s speed, but there are a few techniques to lower the number of requests your site makes — we’ll take a look at some of these below.
How to Measure Your Loading Times
Before you learn how to lower your loading times, you’ll need to know how to measure them. GTmetrix is a great tool for this, letting you measure your site’s performance and get all sorts of information and actionable items for free. Check out our dedicated GTmetrix guide for more information.
When you’re running your performance tests, it’s important to consider a few things:
- Variability — make sure to run multiple tests at different times of day, so you get a full picture of your site’s load times. Individual tests can vary, so you need to run multiple tests if you want accurate data.
- Test Location — try to choose a test location that’s near to your target audience, so you can accurately capture their experience. Or, if you have a global audience, make sure to test from different locations around the world to see how different visitors will experience your site.
GTmetrix and WebPageTest both let you change test locations, devices and other variables.
What’s a Good Loading Time?
First, it’s important to remember that there’s no single page load time for your site. Beyond any optimizations that you’ve made, how quickly your site loads depends on other factors, such as a visitor’s location, device (e.g. desktop vs smartphone), and connection speed (e.g. 3G vs a fast wired connection).
Additionally, a good loading time on desktop isn’t necessarily the same as a good loading time on mobile, though the data is similar.
For mobile devices, Google recommends you try to keep load times under three seconds. Above that, and the probability of your visitor bouncing away almost doubles.
It’s tough to find similar data for desktop visitors, but you’ll also see a similar jump around three seconds on desktop devices — at least according to this data from Pingdom. However, the jump in bounce rates isn’t nearly as large as it is for mobile visitors, which suggests that desktop visitors are a little more forgiving.
In general, though, you want to shoot for three seconds max.
How to Decrease Your Load Times and Make WordPress Faster
While some of these tips may sound a little technical, you’ll be able to perform all of the tactics in this first section without needing any special technical knowledge. Most of them involve making smart choices and installing WordPress plugins where needed.
Choose a Fast Host
I’ve already mentioned the importance of a good host — our guide to the best WordPress hosting services should help you to make an informed decision.
A good host not only offers advanced services, such as backups, site monitoring and the easy addition of new sites, but also puts in place optimizations to make sure your site loads quickly.
If you want fast WordPress load times, your best choice is to pick a managed WordPress host that’s optimized specifically for WordPress performance.
The three best managed WordPress hosting services are WP Engine, Kinsta and Flywheel. All of these provide top-quality hosting, and, while they have their differences, I’d trust my business to any one.
One thing I’d caution against would be using the managed WordPress hosting services of companies that focus on other forms of hosting as well. These services are usually cheap and aren’t really WordPress-specific, just a repackaging of their existing shared or VPS plans. This doesn’t necessarily mean they’re bad, but companies that specialize in WordPress services are a lot better at this kind of thing.
Update Everything (Especially PHP)
First of all, make sure you always use the latest version of WordPress. Since version 3.7, WordPress has had automatic updates for minor releases and security updates. When a new update comes along, you’ll get a notice in the admin. Don’t dismiss it as a chore for later — it takes less than a minute, and will increase your website’s security and possibly speed.
Make sure your plugins and themes are also updated for the least buggy, most up-to-date, most secure and fastest versions of these products.
That takes care of WordPress, but don’t forget your servers — especially your PHP version. PHP is the base language WordPress is written in, and the speed difference between the latest version of PHP and previous versions is dramatic. For example, according to Kinsta’s WordPress PHP benchmarks, PHP 7.4 processes more than triple the number of requests per second vs PHP 5.6.
Despite that huge difference, over 25% of WordPress sites are, unfortunately, still using PHP 5.6 or lower.
High-end hosts will manage this 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 reaching out to your host’s support.
Use A CDN
I’ve mentioned CDN services before in relation to lowering pings. A CDN is a distributed network that serves content to your visitors from a location that’s geographically closer to them. If I serve an image through a CDN, viewers in the US may receive the image through a datacenter in Texas, while Europeans may get it through a datacenter in Germany.
Decreasing the distance data has to travel lowers pings and transfer times, and reduces stress on your site’s server, as your static content is now distributed all over the world.
Or, you can also use the free Cloudflare service, though that takes a little more setup because you need to change your domain’s nameservers.
You’ll also find a number of premium CDN services such as:
Many premium managed WordPress hosts also bundle in a CDN service at no extra cost. This is true for WP Engine (via StackPath), Kinsta (via KeyCDN) and Flywheel (via Fastly). This is yet another reason to use managed WordPress hosting.
Use Page Caching (At the Server Level, if Possible)
When you serve a page to your viewers, the following happens: PHP code is executed and processed on the server, resulting in HTML code that’s sent to the user. The resulting HTML is often the same, but it’s still processed every time.
Take a blog post, for example. It doesn’t change unless it’s updated, but the PHP code is still processed every time.
Caches save valuable server time by ‘saving’ the result of the processing operation. The code is executed and processed, and the resulting HTML is stored in the cache. For subsequent visitors, the processing is skipped altogether and they receive the saved HTML version.
Basically, your server has to do less work to deliver your site’s content to each visitor.
This not only speeds up your site, but can be a huge help in dealing with traffic surges, since the server doesn’t need to process every request.
The best way to implement caching is by choosing a managed WordPress host that implements caching at the server level. That way, your server doesn’t even need to load WordPress to serve up the cached page. WP Engine, Kinsta, and Flywheel all implement caching at the server level.
If that’s not an option, you can also add caching with a WordPress plugin. This isn’t quite as good because your server still needs to load the WordPress application before delivering the cached page, but it will still offer a massive improvement over not using any caching.
Here are three of the best caching plugins:
Note: You only need one caching plugin, and you don’t need a caching plugin if your host has already implemented server-level caching.
Optimize Your Images
On average, images account for about 50% of the file size of a web page. So, if you can shrink your images by optimizing them, you can make a big improvement to your site’s page load times.
There are two parts to optimizing your images:
- Resizing — change the actual dimensions of your image to match your needs. For example, if your theme’s content area is only 800 px wide, you should use at max images that are ~1,600 px wide (you want to double the width of your content area to account for Retina screens).
- Compression — shrink the file size either with no loss in quality (lossless compression) or with a small, often unnoticeable drop in quality (lossy compression).
If it fits your workflow, you can optimize your images before you upload them to WordPress using the likes of Photoshop. All image editors allow you to choose JPEG quality, so use the lowest setting possible. In many cases, you won’t notice the difference between 100% and 60% quality, but the file size could be cut by half (or more).
If you want a more hands-off solution, there are also plenty of plugins that can automatically resize and compress images as you upload them to WordPress. ShortPixel and Imagify are two good options that have limited free plans. Smush is another quality option with an unlimited free plan, but it only lets you use lossless compression unless you subscribe to WPMU DEV (our review).
Review Your Plugins
If you have a very sluggish site, reviewing your plugins could be one of the best moves you make. I recommend going over your list of plugins twice. On your first review, identify plugins you don’t use or don’t need, deactivate them and then delete them.
Now that you’ve weeded out any unnecessary plugins, it’s time to review what’s left to see if there’s room for improvement. Make sure each plugin is the best on offer: There are thousands of plugins in the repository, so choose the ones that are trusted, tested and of high quality. As always, we have you covered — take a look at our guide to choosing plugins for some tips on getting the best.
You should aim to have as few plugins as possible, as by optimizing your plugin usage* you’ll be lowering the number of requests your site makes, which increases speed even more.
*Using more plugins won’t automatically slow down your site because it depends on what each plugin actually does and how well it’s coded. But, unless you have the knowledge to analyze a plugin’s performance by yourself, it’s best to stick with the rough rule that more plugins means a slower website.
Enable Gzip Compression
The size of web pages can contribute to download speeds considerably. By using gzip to compress the website (this is much like using zip archives), you can decrease the size of your page, and so the time it takes to retrieve it. On average, gzip can reduce file sizes by around 70%.
Many WordPress performance/caching plugins already have a feature to enable gzip compression. This includes WP Rocket, WP Super Cache and WP Fastest Cache. There’s also a dedicated plugin called Enable Gzip Compression that focuses entirely on gzip compression.
Or, you can manually enable it by editing your .htaccess file — check out our guide.
Minify and Concatenate Files
Minifying files is another handy way of reducing their size. Code is written to be read by humans, but machines don’t need all of that extra spacing and readable variable names. Minification gets rid of everything that’s only needed for readability, such as spaces, line breaks, and comments.
Some WordPress caching/performance plugins include built-in tools for this. For example, WP Rocket lets you 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 minify and concatenate your files.
As a website owner/user, there’s only so much you can do to speed up your site. Many fundamental sins are committed in the code, and there’s not much you can do about that — unless you’re willing to get your hands dirty! Without getting into the nitty-gritty, here are the most common issues you’ll encounter — and how to solve them.
Put Scripts in the Footer
Loading scripts takes up valuable requests and bandwidth. While some need to be loaded in the header (the part of the website that loads first), most will work just fine if loaded in the footer — the part of the site that loads last. By the time the browser gets to load the footer of your website it’ll have loaded your content, so the viewer can start reading while the scripts in the footer are loaded.
The solution is to move as much as you can to the footer. In WordPress, you can do this using the wp_enqueue_script() function — take a look at the linked documentation for more details.
Load Important Content First
The same kind of logic can be applied to how your content’s structured. If your sidebar is loaded before your content and something goes awry, it’ll hold up the whole site. If it’s loaded after your content, it may still cause the site to hang, but, by that time, the main content will have loaded.
Structure your code in a way that allows your primary content to load as soon as possible, so if anything goes wrong users have something to look at — and they may not even notice the issues.
Optimize Your Database
With time, any database will deteriorate. The worse your code, the faster this will happen. Luckily, MySQL has some great tools built in to repair these problems. Large databases eat up more RAM and slow down queries, which leads to longer processing times, which can add up to ten seconds of load time!
As you can see, there’s a lot you can do to speed up your website! Some methods are for developers (or for the more adventurous), but there are a bunch of easy tweaks you can perform as a regular user to increase your site’s speed, especially with the help of some free or affordable plugins.
If you choose quality hosting, are smart with the plugins that you use, and perform some basic optimizations (such as compressing images and implementing page caching), you should have a WordPress website that can load in under three seconds.
All comments are held for moderation. We'll only publish comments that are on topic and adhere to our Commenting Policy.