You’ve built your website, you’re getting traffic through your analytics but you just aren’t getting the kinds of benefits you’ve expected. Your repeat visitor rate may be low and the time people spend on the site doesn’t suggest interest or engagement.
How long are you willing to wait for a page to load? At what point do you say “enough is enough,” close the tab, and click somewhere else? According to studies, a one second increase in page load time correlates to 7% in lost conversions and sales while 40% of people who visit a site will abandon it if it takes more than three seconds to load.
As someone running a website, I can tell you speed has a huge impact! Luckily, there are some things that you can do to combat slow load times on your WordPress site. Some of these tips are WordPress specific, while others may be used more generally.
Before we begin, there are a few key terms that we will be using throughout this guide. Let’s cover them first.
- Time To First Byte (TTFB): Amount of time it takes for the visitor to receive the first bit of information from your website. This is typically affected by your host and by the amount of code (plugins + theme) that has to run before any information can be sent.
- Start Render / First Visible: When the content of your site first start being visible to the visitor (text is usually first, followed by images).
- Load Time: Load time is how long it takes for your site to be completely loaded, including all text, images, fonts, and scripts.
- Requests: Requests are the number of files that are called and loaded by your site. These can either be internal (hosted on the same server as your site) or external (such as font files from Google). Generally, a lower number of these is preferable.
Before We Begin
Before we begin, I suggest taking a starting benchmark for your site, so you can measure improvement. These tools will also give you feedback for specific areas to improve on. We’ll be using the following three tools today:
Run your site through each of these, and bookmark the results.
I also strongly suggest taking a backup of your site or working on a testing server if possible. As with any website, there is the potential for causing errors if you are not careful, and a current backup is always nice for peace of mind.
Common Causes for Slow Sites (and Their Fixes)
Optimize / Resize Images and Video
The largest files on websites, and thus slowest loading, are images and videos. There are a few simple tips you can follow to help speed up your site when working with images.
- Resize your images. Look at your site, and see how you are using each image. Is your logo just taking a small corner of your site? Then you don’t need such a large resolution. Open your photo in any photo editing software, and resize to something more appropriate. This can reduce the load time of your page dramatically.
- Compress and optimize your images and videos. Once you’ve resized your images, you can optimize them without losing any quality. There are several free websites to optimize images on an image by image basis, such as compressor.io.
There are also several plugins you can use to handle this automatically. Many of these are free for a set amount per month, and relatively inexpensive afterward. I personally like Tiny Compress Images plugin, by TinyPNG, since it also includes compressions from files already uploaded in its free version.
Consider looking into a CDN if your site has global reach, to speed up remote loading. CDNs work by placing copies of your static content (images, scripts, and videos) on servers around the world. As visitors come to your site, the assets are served from the server that is closest to them, reducing latency as the files are transmitted.
A free account with CloudFlare is perfect for just starting off, if you expect your site to be read worldwide. If your site is local only, it may actually increase your site load time, so some testing may be needed.
Optimize Your Code and Code Delivery
- First, look at the plugins you currently have installed. Are there any that you can do without? If so, remove them. Are there any plugins where you only use a small subset of the features? That’s a good candidate for replacement with a smaller, more targeted plugin then.
- How bloated is your theme? If your WordPress theme has a demo page, run that demo through the testing sites above. If it scores extremely poorly, consider the trade-off of switching to another theme.
- Are there any external sources you can do without? If Facebook loads 15 scripts on your page, is there a way to accomplish the same goal without? Or maybe you want to look at using a locally hosted font file, rather than downloading it from Google each time.
Optimize and Serve Your Content
You will also want to install Remove Query Strings from Static Resources, to allow all script and CSS files to be cached. Just install and activate this one, no configuration required.
Once you have it installed and enabled, you should make sure everything is set to “defer”, and on the bottom, be sure to enable Autoptimize support. The same note applies as with Autoptimize: if something breaks, you can add it to the exclude list. This may take trial and error.
The last step we’re going to take here is to set up a caching plugin. After you have a visitor to your site, a caching plugin builds a static copy of your page. This static copy is served up to future visitors, bypassing all of the source code calculations required and speeding up subsequent page loads. There are many options here, all with their own advantages and disadvantages. I personally like Cachify, where you just install it and activate, and the default settings work great.
NOTE: Since everything is saved (by default for 12 hours), you will occasionally want to force a cache reload early, especially if you are doing things like editing or publishing articles. Cachify flushes the cache automatically when you post a page, but when you make an edit, you may need to flush it by clicking the trashcan in the top right end of the admin bar. You can also exclude individual pages from the cache in the Cachify settings page, if you have something that changes often (such as a WooCommerce checkout, etc).
Optimize Your Server Settings
This section is highly dependent on your individual hosting situation. Not all of these options will be available for all hosts. If you are unsure, I would contact your hosting provider. These will mostly impact time to first byte, and some of the options such as gzip and file expiry settings. If your host cannot answer these questions to your satisfaction, or if you are still getting a slow TTFB (WebPageTest) after completing the other steps, it might be time to consider moving to a new host.
I would ensure that your host is running a minimum of PHP 5.6, or preferably PHP 7 (with a significant speed boost over 5.x). PHP 7 enables opcache PHP server-side caching by default (this works well with Cachify). You will want to make sure that gzip is enabled on a server level. There are other options for speeding up your site load on the server itself, using setups such as Varnish caches and other configurations beyond the scope of this article.
If you are using Apache as your web server, you can place (or modify) a .htaccess file inside your main WordPress site folder. Below are settings to enable expires headers for all of your site content. These tell visitors’ computers to not re-download things such as images, scripts, etc, until a certain amount of time has passed. This is very useful for things that are not going to change so that subsequent visits load much faster.
Or if you want to keep things simple, upgrade to fully managed WordPress hosting. It’s a larger investment, but your hosting provider will handle all this for you.
These are the major issues that can slow your site down. There’s always room for more improvement, but these should get you a good start.
Just a couple of caveats on the speed testing sites that we used earlier:
- It’s often not doable (or even desirable) to get 100% on any particular speed-test site, without severely crippling the features that you want to offer. Instead, shoot for the fastest speed that you can get without sacrificing quality.
- Each of the sites’ tests different things, and measures in different ways. Don’t worry about the letter grades or percentages. Instead, check and make sure you’ve worked on the categories as much as you can. The parts that really matter are TTFB, Start Render, and Load Time, as these are what the visitor will see in the end.
Want to give your feedback or join the conversation? Add your comments 🐦 on Twitter.