- By
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 the chances of your website ranking well in search engines, like Google. In short, your website needs to be fast! How fast? Well, generally speaking, pages should be loading in less than an absolute maximum of about 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.
Site Speed Factors
There are a few factors that determine the speed of a website — here are the ones we’ll look at in more detail:
- Ping
- Hosting Quality
- Code Quality
- Website Requests
Ping
The ping is essentially the time it takes for a query from your computer to get to the 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 CDN services to lower pings on average. We’ll talk more about CDN services below.
Hosting Quality
Hosting is probably the most important factor in your site’s speed. It not only affects the 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 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.
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 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.
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.
Measuring 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 (there’s also a paid plan, which may suit if you test regularly or need more advanced options). Check out our dedicated GTmetrix guide for more information.
Other options include Pingdom, which is a similar service, or browser-based tools such as YSlow, which can be found within the Chrome/Firefox/Safari extension libraries.
What’s a Good Loading Time?
This really depends on what you’re doing, but, in general, it shouldn’t be more than three seconds. If you mainly have text with an image or two, your site should load in less than two seconds. A mid-range site with a couple of images and lots of text is capable of loading within 700ms if everything is optimized and your host is top-notch.
Decreasing Loading Times
Some of the methods listed may be a bit more advanced than your current skillset (the more accessible tips are nearer the top), but don’t worry about that too much — implement anything you can from the list and try a new method every week after that. Any speed increase is valuable, so don’t fret if you don’t go through the whole list right away.
Choosing the Best Host
I’ve already mentioned the importance of a good host — our Guide to the Best WordPress Hosting Services should be able to help you make an informed decision.
A good host offers advanced services, such as backups, site monitoring and the easy addition of new sites. I’ve become very fond of managed WordPress hosts recently — they have the advantage of being focused on WordPress, so they even assemble their hardware according to its needs.
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 re-packaging of their existing shared or VPS plans. This doesn’t necessarily mean they’re bad, but companies that specialise in WordPress services are a lot better at this kind of thing.
Plugin Review
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.
Keep in mind that you should never have more than one SEO plugin or caching plugin installed at once, as this will slow your site dramatically. In fact, if you use managed WordPress hosting, you may not need a caching plugin at all — ask your host about this to make sure.
Now 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: By optimizing your plugin usage, you’ll be lowering the number of requests your site makes, which increases speed even more.
Update Everything
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.
You can also configure your site to automatically apply core updates — take a look at the automatic update guide in the WordPress Codex.
Make sure that 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 the previous one is dramatic, with an increase of almost double across the board (check out the PHP performance insights to see for yourself).
High-end hosts will manage this for you, or you may be able to set which version of PHP your site’s using yourself. Take a look in your website’s control panel or drop your host’s support staff a line and ask them to put you on PHP7 — it’ll make a huge difference.
Use A CDN
I’ve mentioned CDN services before in relation to lowering pings. A CDN (content delivery network) 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 the stress on the network, as it’s now distributed all over the world.
Using a CDN will also make life easier should you want to transfer your website to another location, or work on it locally. Since content served from a CDN is in the cloud, you don’t need to move it when moving a site, which is a huge productivity gain!
A CDN solution usually consists of two parts: A storage location and a delivery network (the latter is the actual CDN). Amazon, for example, has a storage solution named Amazon S3, and you can tie in Amazon’s CDN solution — CloudFront — to make sure your content is distributed in its network.
Setting this up is easier than you may think. Take a look at our guide — moving WordPress media to Amazon S3 — for more information.
MaxCDN and CDN77 are also great CDNs, and are cheaper (and often faster) than Amazon’s solutions.
Use Caching
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.
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.
Currently, there are three well-known all-in-one caching solutions for WordPress: W3 Total Cache, WP Super Cache and WP Rocket.
W3 Total Cache and WP Super Cache are free, and the former has the better reviews. WP Rocket is a newer addition to the group, and, according to reviews, it has the fastest performance. However, it’s a premium plugin, so will cost you money.
Before you test caching solutions, remember the advice we gave earlier: Never install more than one caching plugin, and ask your host if you need one at all. Installing more than one caching plugin is a horrible idea, as it will likely slow or break your website, and if you’re on a managed WordPress hosting plan your host may have something built in at the server level that’s much faster.
Optimize Your Images
WordPress does its best to serve optimized images, but there are some things it simply can’t do. It’s best to optimize your images before you upload them 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).
There are also some tools you can use to batch-optimize images. ImageOptim is a great tool for OSX users, while RIOT will be helpful to any Windows users out there.
It’s best not to go overboard with image sizes, and here’s why: When you upload a 3000×1000 image, WordPress will save specific sizes of it, which are defined by your theme. If your theme uses a 900×300 featured image, the large image will be downsized to those dimensions. All good so far: The appropriate image will be used.
If, for any reason, the image size doesn’t exist (an error, you switched your theme), the original 3000×1000 version may be used. You probably won’t be able to see the difference, but you’ll have just added 1MB to your site’s size, thus decreasing your speed.
When you change your theme, your image sizes will be all over the place: Your new theme may call for a 300×100 featured image, which simply won’t exist. Your best bet is to regenerate your image sizes when you switch your theme, using a plugin such as Regenerate Thumbnails. It may take a while if you have thousands of images, but it’ll speed up your site considerably.
Hire a Good Coder
I can’t stress this one enough. Hiring a good developer and working with him or her consistently is akin to paying a little extra for better hosting. You may not feel the effects in the short term, but you’ll curse yourself for choosing the cheap option in the long run.
The truth is that WordPress is easy to code for. PHP isn’t a difficult language, and WordPress has so much documentation that you can learn how to make a basic plugin in a couple of weeks. This is great in many ways, but it can also mean that a lot of people offer their services before they’re ready to do quality work.
In development, if the cost seems too good to be true it probably is, and the quality of work will suffer. An experienced developer doesn’t just know how to implement the things you need — they know how to implement them in an optimized, future-proofed way.
Paying $50 to $100 an hour may seem like a lot, but I guarantee that you’ll pay more in the long run if you get someone subpar to work on your site.
Educate Yourself
Another great way to increase your website’s performance (not just speed-wise) is to learn about the technologies you’re using. There are guides, tutorials, videos, articles and forums on every topic imaginable — from tracking your website with Google Analytics to using WooCommerce — so you should find everything you need.
Learning as much as you can will help you to manage your website better, and enable you to communicate more effectively with developers and designers.
Development Tasks
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.
Putting 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’s 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.
Concatenating and Minifying Files
Concatenating (merging) files helps reduce the number of requests a site makes. If your site contains 10 JavaScript and 10 CSS files, you’re making 20 requests. If you merge all your JavaScript files into a single file, though (and do the same for your stylesheets), you’ll reduce your requests to two, which will save you a lot of loading time.
Concatenating can be done manually with the terminal or command prompt, but is more commonly done using build tools such as Gulp or Grunt — both have concatenation extensions. You can also use GUI tools such as CodeKit or Prepros.
Minifying files is a handy way of reducing their size. Code is written to be read by humans, but machines don’t need all 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. Even better: the tools used are the same as above!
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 10 seconds of load time!
SiteGround has a short tutorial on optimizing a MySQL database using SQL queries, and one on using phpMyAdmin to optimize a database.
Enable Gzip Compression
The size of webpages 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.
To get it to work, you’ll need to edit your .htaccess files — GTmetrix has a great overview of how this can be done.
Final thoughts
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.
One of the smartest things you can do is research the plugins and themes you use, and be consistent with the decisions you make. This will help make your website faster — and keep it that way!