One of the questions I come across the most is how to speed up a WordPress site. I gave a talk at a few WordCamps called “Speeding Up WordPress” and was overwhelmed by the number of people who are looking for ways to do this.
You can check out my slides from WordCamp Birmingham 2018 below or continue reading to learn how to get started.
Why does speed matter?
Before we can look at ways to speed up your WordPress site, we need to first look at why we should even care how fast the site is. Almost every site has two main functions:
- Getting content in front of an audience
- Getting a visitor to do an action (defined as a “conversion”)
Depending on the goals of your site and brand, the content and action may differ quite a bit. For example, your goal may be to get the visitor to buy something in your store. Alternatively, your goal may be to get the visitor to sign up to your email list.
Since 2010, Google has been using the speed of a site as a factor in ranking a site in searches. Starting this year (2018), Google has begun using the speed of the mobile version of a site as a factor in rankings too. So, the slower your site is, the fewer people that will find your site!A WordPress site loading slowly affects its SEO and conversion rate! #WordPress #performance Click To Tweet
Once visitors are on your site, the speed of the site can affect the conversion rate. The conversion rate is the percentage of users that do the action you want them to. The slower the site loads, the smaller the conversion rate. For example, Amazon found that page load slowdown of just one second could cost them $1.6 billion in sales each year. Even worse, 79% of dissatisfied users will not revisit an under-performing site.
How to test your site
So, how fast should your site load? In a study from a few years ago by Kissmetrics, they found that 47% of users expect a web page to load in 2 seconds or less. After waiting that long, 40% of users will abandon a site after 3 seconds. Since then, users have expected sites to load even faster.
Based on those numbers and more, you should aim for your site to load as fast as possible. A site loading less than 1 or 2 seconds is the goal.
Once we establish the goal, we need a way to test the site. Here are four ways you can test your site:
- Pingdom’s free tool: Website Speed Test
- Gtmetrix’s free tool: Website Speed Test
- Google’s PageSpeed Insights
- Chrome developer tools’ Audit tab (more for the developer-type)
There are many other tools to which you can find by searching for “site speed test”. Most of these tools will work the same way:
- Enter in your site’s URL
- Select location closest to your site’s demographics (we will discuss this more in a second)
The speed test will run and then tell you how fast your site loads. Most tools will then give you some more data points such as total site size. Finally, some tools will also give you some recommendations as well.
Improving your site speed
We now know why speed matters and how to find out how fast our site is loading. The big question now is “How to actually improve our site’s speed?” Let’s take a look at several things we can do!
Speed begins with hosting
One of the biggest factors to your site’s speed is the hosting provider that hosts your site. If your site is hosted on a server with limited resources and outdated software, your site could be 10 times slower than if your site was with a higher quality hosting provider. In fact, just updating the version of PHP for your site from an outdated version to a current version can speed up your site by 4 times!
So, your very first step is to check on your hosting provider. Is the version of PHP you have on your site at least version 7.0? Is the version of MySQL on your site a recent version? Not sure? You can use our free plugin or reach out to your hosting provider. A good rule of thumb is: If you are paying less than $1 per month in hosting, it’s probably not good.
Some quality hosting providers would include:
- A2 Hosting
- WP Engine
Choose your theme carefully
One of the next big factors in your site speed is the theme of your site. Themes control much of the design and structure of your site. A bad theme can be 4 times slower than a quality theme.
Since there are tens of thousands of themes, it is difficult to give exact tips of what to look for. However, the themes in the WordPress repository (the place that keeps the themes you see when you search in the “Add New” page of the “Appearance” menu) has a set of standards a theme has to meet to be allowed in. If you find a theme you like in the repository, looking at the reviews and support forums can help you determine what other users found while using the theme and if the theme’s developer is dependable.
If you look outside of the repository or at premium themes, trying to get opinions from other users will be helpful. Some of the marketplaces you find may have a review section you can browse.
Almost all themes have demos. Since many themes have a paid component, they will ensure the demo is a high-quality demo. So, a good tip is to take the URL of the demo and put it into one of the speed tests. You can compare different theme demos using this approach. Of course, there are many reasons why a demo may be slower than another so use this more as an indication as opposed to a hard rule.
Do you need that plugin?
One question that comes up a lot once we start talking about WordPress speed is “How many plugins should my site have?” Since every site is different and every plugin is different, it is impossible to give a recommended number. However, you should aim for as few as possible.
Each plugin you add to your site takes some resources to run and load. Plugins with lots of features and functionality may slow your site down more than a simple plugin. For example, an eCommerce plugin may take more resources than a plugin that adds a shortcode to add a little styling.
Since each plugin takes up resources, you should only install the plugins you absolutely need and limit yourself from adding extras. If you do not use a plugin regularly, de-activate it.
Do your images need to be that big?
When a user goes to your site, their web browser has to download all the elements of your page. This includes the content, the styling, the images, and more. So, the larger the files, the more data the browser has to download which causes the page to load slower.
If you were to take your nice 2000 MP camera and take a picture that is 4000 x 4000 it could be over 100MB! Put a few of those on your site’s homepage and your page could be over 1 GB in size. On a slow 3g mobile connection, a site visitor would wait over two minutes for your site to load.
Of course, that scenario is a bit of a hyperbole but it shows why we want to get smaller image files. There are a few ways to get smaller image files, but we are going to focus on the main two:
- Reduce the length and/or height of the image
- Reduce the quality of the image
Most of the places you will upload images to will give you dimensions that the option is expecting. For example, in a theme, there may be a spot for a background image. The theme will state that it is looking for an image around 1024 x 1024. So, if you upload an image that is 3000 x 3000, you are, potentially, slowing your site a little by going over. Additionally, instead of choosing the “Full Size” option when adding pictures to your posts or pages, you can select a smaller size.
In terms of quality, a lot of photo programs allow you to reduce the quality in terms of percentage. 100% would be full quality. Interestingly, most web users cannot tell the difference between 75% and 100%. So, you can reduce the file size a bit just by removing some quality without anyone noticing. Of course, this will differ a lot based on the type of image and where it is located on your site. So you will want to test a bit to get the best outcome.
Keep in mind that WordPress does lower the quality on images when you are not choosing the “Full Size” option.
You can change file size using a tool such as Photoshop, or a free equivalent called GIMP. Additionally, you can use the free plugins, “Smush Image Compression and Optimization” or “EWWW Image Optimizer“, which will optimize your images when you upload them. Another good tool to consider is the service Kraken.io.
Every time a user visits a page on your site, there are a lot of things WordPress does. WordPress loads the theme, performs any calculations the theme or your plugins need to perform, loads the content, any comments for the page or post, and widgets on the page, and more. This can take significant time depending on how much loading and processing there is.
Caching is the concept of running all of that one time and creating a copy of it. Then, when a visitor goes to a page on your site, they get sent the copy instead of having to wait for all the processing. This can massively decrease how long a user is waiting for your site to load.
Caching comes in many different forms including server, browser, and plugin. In most cases, you will only control the plugin caching. Your hosting provider may set up server caching in some form and you should check with your hosting provider. Depending on the setup, you may not be allowed to install plugin caching plugins on your site.
If you can install caching plugins, then, instead of relying on server processes to create the cache, you can have a plugin do it. Some popular plugins for this include W3 Total Cache, WP Super Cache, and Breeze. Depending on the plugin, when you make a change, such as editing a post, you will need to “purge the cache”. Sometimes, this is labeled as “empty the cache” or “flush the cache”. Essentially, this refers to refreshing the current “copy” of your site that your visitors to see.
Offloading and CDN's
Remember way back at the beginning of this article when I mentioned choosing a location closest to your site’s demographics? Well, there is a big reason why this is important. The internet, your website, all your visitors, your computer, and everything else is connected by wires. The longer that wire is, the farther the data has to go, the longer it will take to get there. So, if your site is hosted in Sweden and your users are on the opposite end of the world, your site may take a very long time to load for them.
This is where offloading to CDN’s come in. a CDN (content delivery network) is a series of servers optimized for sending files to users. Instead of your files being only located in Sweden, you can use a CDN to have files around the globe. So, when a user visits your site, it will load files from the server closest to them.
You can offload a variety of files including your images, PDFs, styles, scripts, and more. There are many services that offer CDN’s. Many hosting providers may offer a CDN that you can enable. This would be the first place I would recommend checking. Some hosting providers allow you to turn on the CDN and they take care of the rest.
Another popular CDN is Max CDN which has a WordPress plugin. You can also use Amazon’s s3. A good option is to use the WP Offload S3 plugin with Amazon S3.
While I discussed quite a few things in this article, this was only a small introduction to site speed. Each of the items above could have an entire series of articles dedicated to them. However, by choosing a quality hosting provider, a good theme, limiting plugins, and optimizing images, you can greatly reduce your site’s speed.
If you haven’t yet, install our free WP Health plugin to check some items on your site that may affect speed and security!