2014-03-27

One of the most common queries we get at WP Curve is ‘can you make my site faster?’. Website speed is important for a variety of reasons. Here are 4 key reasons:

A faster site will increase your conversions.

A faster site means Google will love you.

A faster site will provide a better experience for your customers and visitors, resulting in fewer bounces.

The speed of your site is part of your brand.

The final reason was the most important to us because we’re a WordPress support provider.

In this post, I’ll run through some very specific actions you can take to speed up your website. We’ll use our site as the benchmark and demonstrate how we reduced our page load time to under 1 second.

We’ll also address the common reasons for slow websites, so you can work out which ones you need to deal with in order to improve your own page speed.

Find out how to reduce your WordPress load time to under 1 second – CLICK TO TWEET

Before and after results

Here are some before and after results from our site.



Our original site was put up quickly and like many websites, we added things over time that weighed it down. When we decided to invest properly in the site, it was clear it had to be completely re-developed.

The result above, 5.2 seconds is just outside the acceptable range for a typical small business. But we wanted to demonstrate best practice and get the download time to under 1 second.

Note the result above was when we were hosted on our own Virtual Private Server (VPS), running W3 Total Cache and running a Content Delivery Network (CDN) tool CloudFlare. It was as bad as 10 seconds without any caching.

Here’s how it’s looking now:



Note the Pingdom speed test tool can be a bit inconsistent, but I’ve had consistent times of under 1 second which was our goal.

Ok let’s get stuck in to the major ways you can speed up your site.

Hosting

The quickest and easiest win you can have with page speed, is upgrading from a cheap shared hosting provider to a managed WordPress host. Cheap hosts are good for when you are starting out, but for ultimate performance you can’t match a managed WordPress host.

Even our clients who have signed up with a dedicated server or a VPS (Virtual Private Server) struggle to match the performance of a managed host. As you can see from our results above, just having your own server doesn’t mean your site will run quickly.

We host on WP Engine and noticed an immediate 54% speed improvement the day we moved. They have a smart way of managing WordPress sites. They limit certain plugins, have different ways of managing caching and re-directs and have a built in CDN that serves images and other files at lightning speed.

Prior to WP Engine, we were hosted on our own VPS and we had a CDN as well as a caching plugin installed. So a 54% speed improvement was pretty remarkable.

If you want to know if your host is an issue, here are 2 easy tools you can use.

Google PageSpeed Insights

A really quick and dirty test is to enter your domain into Google PageSpeed Insights. If one of the issues raised is ‘Server response time’, then you can get a big win from hosting with a fast host.



I’ve seen these as high as 5+ seconds which is obviously a big problem if you want to get your entire site to load in a few seconds. This is just the time it takes to hear a response from the server, let alone load the whole site.

Pingdom Speed Test Tool

The Pingdom Speed Test Tool will give you some quick information about the speed of your site. This doesn’t just relate to server speed, it will give you a lot of useful and actionable information. Here’s a rough, subjective guide of what is acceptable:

Under 1 second is excellent

Under 2 seconds is good

Anything around 5 seconds or more requires action

These times can be influenced by a lot of things, but as a guide if you are under the 2 second mark, you probably won’t experience a huge win by changing hosting.

Plugins

It’s not just speed. Your choice in plugins will be a common reason behind a lot of WordPress problems. Because plugins are written by different developers with varying skills, you need to be careful what you install and how many you install.

As a general guide, we like to keep sites to under 20 plugins. A better rule of thumb is ‘less is best’. If you can have 0 then that’s fantastic, but probably unrealistic. We have 2 recommendations here:

Remove any plugins you don’t need

Remove any inactive or active plugins that you don’t need. Here are the plugins we removed and the reasons for removal:

Akismet – We use Disqus which is great spam filtering for blog comments.

CloudFlare – We are no longer using CloudFlare as we use the CDN that is part of WP Engine (Max CDN).

W3 Total Cache – This is best done at the server level and we now use WP Engine’s caching features.

Backup buddy – Again backups are best done at the server level, WP Engine handle this in a very simple way.

C Metrics – This is our own analytics plugin. It provides great information but we can get the data outside of WordPress. If your priority is speed, then these sorts of plugins can be left out.

Price Table – We coded our own pricing table into our sign up page.

Slingpic – This gave sharing options for images which I don’t think people tend to use too much. We can live without it.

WordPress Importer – This is a plugin that is often left installed after moving sites. We removed it. There are a lot of plugins that you only tend to use once that are best removed after use.

Youtube Shortcode – We use LeadPlayer to handle videos so we could remove this plugin.

Zilla Shortcode – We weren’t using it.

All In One Favicon – WE included the favicon code in the theme so we could uninstall the plugin.

This left us with 16 plugins on the site. Note I’m not saying these plugins are bad. This is just typical of a small business website. If you aren’t checking regularly you end up with a bunch of plugins that you can live without.

Removing plugins generally means doing one or more of the following:

Going without certain features, if you decide that speed is more important.

Using plugins that perform more than 1 function instead of 2 plugins. For example using WordPress SEO from YOAST as the SEO plugin and for site maps. We see a lot of clients with 2 separate plugins not realizing that YOAST already creates site maps.

Removing any plugins that are particularly slow. The P3 profiler plugin can be used to find slow plugins, but make sure you remove it after you use it because the plugin itself will slow your site.

Performing other functions outside of WordPress. For examples analytics, email, backups or broken link checkers can all be done outside of WordPress.

Disabling plugins you only use from time to time. For example the WordPress importer is a common one. If you aren’t using the plugin regularly, you can remove it and add it later when you need it.

Avoid problematic plugins

There are certain plugins that we’ve found can really slow down sites. I won’t mention specific plugins here because we are often going back and forth with plugin developers to get them to resolve issues. However there are a few common culprits.

Premium plugins with encrypted code. The plugin has to go back to a 3rd party server and decrypt the code, and that process slows the load time significantly.

Re-direct plugins with lots of redirects. They can dramatically slow down the speed of the site.

Any plugin that performs a lot of database queries. WP Engine have a good list of these plugins here. ‘Related post’ plugins are a common problem.

Plugins can have a huge impact on your site speed so be careful about what you install.

Site size

A common reason for sites being slow is because of the size (in kilobytes) of all of the elements that make up the site, namely scripts and images.

The Pingdom Speed test tool can tell you how big your site is. Our site was only 1.4 MB, which is OK. We’ve seen plenty of sites that are 4mb plus and that will have a massive impact on your download speed.

Here are some rough, subjective guidelines around the size of the site:

Under 500kb is excellent

Under 1mb is good

1-3 mb is acceptable

3mb plus requires action

The culprit for a large site is often large images. Here are 2 ways to find if you have images that need to be optimized:

The quick and dirty way is to use the Pingdom site speed test tool and after you run the test, click the drop down and choose ‘Sort by file size’.

If you have images in here that are over 100kb then you can take action on those images.

A better way is to use GT Metrix. Visit GT Metrix, enter your domain name and run the search. This will give you a bunch of important facts and specifically lists all of the images that need to be optimized. It even optimizes them for you which is a neat feature. You’ll have to download them and replace the ones on your site.

Here are a few other tips for optimizing images inside WordPress:

Optimize all images before you load them into WordPress. As a general rule, I like all images to be well under 100kb. Simply right click on the image on your computer’s file manager and choose Properties. If the size is bigger than 100kb then it’s too big. Use an image editing program or a site like picresize.com. You’d be amazed at how many speed issues are resolved by optimizing a few images.

Use the exact required size for images and don’t rely on your theme to resize them. For example, if your theme shows featured images at 120px wide, make sure you create them at exactly that size.

Squish existing images with a plugin called Smush It.

Use less images. You can use more CSS and less images to reduce the overall size of images. Alternatively, you can reduce the overall length of your pages which will also reduce the amount of images used.

Deliver your media files via a CDN. CDN’s like MaxCDN or Cloudflare can serve your images quicker. Managed WordPress hosts like WP Engine have a CDN as part of the package. If you aren’t on a managed host you can sign up for CloudFlare. WP Engine uses Max CDN on the pro plans and up.

Cache your images. If you aren’t using server caching or a managed WordPress host, you can cache your images with a plugin like W3 Total Cache. This improves the download speed, although I prefer having this handled by the hosting provider.

Reducing external scripts

A really common cause for slow WordPress sites, is the existence of too many external scripts. Having Facebook like buttons, your Klout score and offsite videos are examples that can have a big impact on the load time.

Once you load from other sites, it limits your options in terms of how you can treat that script.

Simply removing some of these features can have a big impact on your site speed.

On our blog, we ran with a minimalist design that focuses on the content. We removed Facebook and Twitter share totals from the blog homepage. We don’t use any externally hosted Infusionsoft forms. We compromised by keeping Disqus and SwiftType, because they are exceptional plugins.

For others, we decided we could live without the feature in favor of having the blog load quickly.

Simply deciding that you can live without certain features is sometimes all it takes to get a significant boost in speed. Here is a list of some common external scripts:

Video scripts like Wistia or YouTube embed scripts.

External commenting plugins like Disqus or Google+ comments.

Social media buttons like Twitter follow buttons and Facebook like buttons.

Social sharing plugins for blog posts.

Live chat plugins.

Conversion plugins like pop-up scripts and opt in forms.

Analytics services like Google Analytics or Infusionsoft web tracking.

External font scripts like Typekit or Google Fonts.

Not to say you should always turn these off, it’s all a compromise you may really want some of these features but you can compromise on others.

To work out which scripts are particularly big, you can use the same approach above with the Pingdom Site Speed Tool and filter by size. GT Metrix will also tell you how many external JavaScript files your site is loading. From there you might decide you can live without some of them, combine them or make them load later (more on this later).

Too much ‘baggage’

One thing that could be slowing down your site is the sheer amount of ‘stuff’ that has accumulated on your site over the years.

We found a big improvement just from re-doing the theme on our site from scratch. Even though we’d only built the old site 8 months ago, we’d added to it quite a bit and it had filled up with code that wasn’t necessary. Coding a new theme from scratch meant a lot less code.

This is not the only type of ‘baggage’ that can slow down a WordPress site. Here are a few other manifestations:

Databases that have become huge, particularly WooCommerce sites with lots of old orders.

Sites that are filled up with too many images or too many backups that clog up the server.

Too many plugins.

Too many themes.

There’s no real quick fix to the baggage issue other than to regularly keep an eye on your site and clean it out. If you’re not sure how to do it yourself, it’s probably best to find a developer to do it for you. A few improvements could be:

Removing older orders or making database changes in ecommerce sites. Changing from MyISAM to InnoDB can help sometimes (as your developer about that).

Removing old backups, particularly if there are backup plugins running.

Removing old themes and unused plugins that are taking up space.

Reviewing your theme code or even starting fresh every few years with nice clean code.

Removing any spam comments or trackbacks that you don’t need.

Removing older installations of WordPress on your server.

You can also store media files like PDF downloads externally on Amazon S3.

Think of it as servicing your car. You can’t leave your website in the same state year after year and expect it to perform the same way.

Speed up high traffic pages

I’ve read a few posts about how to speed up your site and very few mention this simple tip. It’s likely that 80% of your traffic is hitting only 20% of your pages. For maximum impact, it makes sense to optimize the most popular pages.

We pay particular attention to our homepage. That’s not only a high traffic page but it’s the one that has the biggest impact on our brand.

First visit Google Analytics, then click Behaviour / Site Content / All Pages. I’m willing to bet your homepage is top of the list. You can apply the same approach to any other high traffic pages.

Simply make it smaller. Include excerpts instead of full posts for example or just have a shorter page with less content.

We took the SSL certificate off our homepage and moved the signup to a dedicated page. I didn’t look at ways to optimize this, but we wanted a dedicated payment page either way and removing the SSL was one thing that could go.

Avoid poorly coded scripts. Some sliders for example can decrease load time by loading a lot of images at once or overloading JavaScript.

Making your home page and other high traffic pages faster will improve the speed for 80% of your visitors.

Some more advanced techniques

The techniques mentioned above should be enough to get your site load time into the good range (under 2 seconds).

If you are really keen, there are some more advanced things you can do:

Don’t load some scripts on high traffic pages. In our case, we moved our live chat script from the homepage and instead put a ‘contact’ us link up the top. We use the live chat script on the contact page. Another example is plugins that aren’t used on the homepage like the SwiftType search plugin can have its associated scripts loaded only on the blog pages.

Use CSS sprites to combine little images like icons. This is a small win, but it all helps.

Loading scripts asynchronously means the page will load before the script has to load in. If it’s not something that is needed right away this can be a great idea. We did this for the video script and the live chat script on our site as an example.

Check that you specify the image dimensions in the HTML code for all images. The GT Metrix report will pick these up for you.

The piece of code below in your theme’s functions.php file will remove query strings from static resources. This ensures that they are cached like other elements.

Thanks to Doug from Efficient WP for supplying that code. He has some more tips here on WordPress speed.

Some things are more important than speed

Just as a final thought, it’s worth keeping in mind that speeding up your site involves compromise. We could probably get our site loading much quicker if we wanted. But there are always competing priorities like:

We want a nice design so we do have a few images on there that take a bit to download.

There are some plugins that give us functionality that we don’t want to live without.

We don’t want to go hacking plugins, so we put up with some performance hits from a few plugins that we do really like.

I could get my developers to constantly tweak the site and scrape a few more milliseconds out of it, but that’s time they aren’t spending helping clients.

I think if you can get your site under 2 seconds then it becomes about prioritization. If it’s important that you have a nice design, you probably do need some decent size images on there. If there are some plugins you can’t live without, it makes sense to keep them and take a bit of a hit speed wise.

Summarizing WordPress speed

You can really go deep on speeding up your WordPress site. You could probably spend weeks fine tuning all of the elements and getting it perfect. But for most people, there are a few major reasons why their site is running slow. And if you don’t deal with these issues, the fine tuning is a waste of time.

Quality of your host.

Physical size of the site, generally due to images.

Number and quality of the plugins used.

Number of external scripts running on the site.

Extra baggage built up over time.

If you have any questions about WordPress speed, please reply in the comments below. If you are interested in support with your WordPress site check out WP Curve.

The post WordPress speed – How to reduce your load time to under 1 second appeared first on WP Curve.

Show more