Tips To Speed Up A Slow WordPress Site

First of all, there is no magic bullet fix. There are thousands of variables involved in a website that can affect your site loading and speed benchmarks. These include the theme you are using, the plugins, your website host, whether you are using a CDN (content Delivery Network) , and many other factors.

What I hope to do in this article is offer solutions for common problems I have managed to overcome on my website along with some speed boost tips. Ultimately you will have to be your own detective and through trial and error,  figure out where the bottleneck is on your site.You know your site better than anyone.

Hopefully some of these tips will help you as well or at least put you on the right track to finding a solution. This is meant to be a guide for novice to intermediate users with links to more specialized tweaks as well. I assume you are here because your site is slow or maybe not as fast as you think it should be. So let’s get started….

speed2

 

Having a fast loading website really is a priority for many reasons. First it is simply annoying to your site visitors and they will leave. No one wants to wait for more than a second or two for a site to start loading.

More importantly it can affect your Google rankings. They reward fast sites and punish slow sites. If you want people to find your site, you do not want Google to punish your rankings and make it nearly impossible for people to find you. 

(This guide is meant to try and correct issues on your end also known as front-end. That simply means things you can change from your computer.  It is also possible the slow speed might be caused by your host provider or back-end. Sometime repairing the database or making sure your hosting software is updated is running the latest version can help. Contact your host for any back-end issues.) Backend issues falls out of the scope of this guide. 

 

The first thing we want to do is get a baseline benchmark test score. Go Ahead an open new tabs in your browser and run these benchmark sites. Your scores can also vary quite a lot based on traffic, time of day, and other factors. You might also consider checking the main home page as well as a few pages inside your site to compare scores. Specific pages that are very slow might be due to photos or videos.

Google PageSpeed 

For the Google test they use color codes in addition to numbers. Ideally you want to see scores that rank green for both mobile and desktop but I have had a very hard time getting green for mobile. In my experience yellow has been plenty fast for mobile and my site seems to load quickly on phones and tablets. I scored 74/100 Mobile (yellow) and 90/100 Desktop (green) with all plugins enabled.

GTmetrix

My Score for this test is 92% Pagespeed Grade and 80% YSlow for Comparison. Notice the tabs and tips below scores on areas you need to improve. These can provide great hints why your site is slow.

Pingdom

I scored 82/100 on this test for comparison. Again notice the various tabs below scores for different problem areas. All of this info provides valuable clues. Look for any areas in red with low scores.

The reason to run all three tests is they offer slightly different clues.  Now my scores are not breaking any speed records,  but they are now twice as fast as they were a short while back which is a huge difference. A slow loading website is the biggest barrier to traffic as people simply click off your site if it doesn’t load within a few seconds. You don’t need the fastest website in the world just fast enough not to drive people away before they can view your fabulous content.

Now that you have those benchmark scores we can begin. Write the scores down to compare later.

First Things First

Before we do any more intense troubleshooting let’s check a few things first. The biggest cause for my slow performance was found in Settings>Sharing. Scroll down until you find this section.

Screen Shot 2014-08-25 at 5.33.28 PM

At some point in time I had accidentally clicked the Front Page Option. That resulted in the Facebook, Twitter and other social media sharing buttons needing to load for all 15 articles on my homepage. That is a lot of buttons to load and was causing extremely slow load times. Make sure if you have many articles viewable on your home page this option is not checked.

Don’t underestimate the power of one single checkmark on a setting somewhere. That one checkmark caused my website to take about 8 or more seconds to load and gave me a very low Google scores. It could be something very simple like this. Try and go through all your various settings and familiarize with each and every one. If your site used to be fast but is now slow did you make any recent changes?

Other things you might want to check: Do you have a background image selected in your theme settings? That can sometimes cause problems. Do you have broken image links from hotlines? Run this test and check.  LINK CHECKER Fix any broken links and image issues. Also try switching the permalinks to a different setting and save, then switch back to your preferred one.

Photos are often a big speed bump for sites. Make sure if you have big HD images you don’t simply make them smaller by pinching windows to fit inside your post. That will not shrink the file size.  Edit the original image itself and try and get it under 1MB in size by reducing dimensions and saving then Smush it. If you have an image around 3MB that will take a long time to load. There may be times when you want large high quality photos so consider using a service like Imgur or similar instead of hosting locally in those cases.

If these tips above didn’t solve your site issue then here are a few more things you can try. 9/10 time it is a plugin issue.

Remove Any Errant Plugins

Inactive plugins believe it or not can still cause speed issues. Consider deleting and removing files from inactive plugins you don’t plan to ever activate again. They are just taking space.

Note: If your Dashboard is also loading slowly but other website you visit are fast  it is almost certainly an errant plugin. If all websites are slow then it could be your own network, ISP, your computer, or a router issue.

Step 1) Make sure WordPress and all plugins are updated. Then begin with Jetpack. Open Jetpack settings and go through each module one by one and disable any you are not using. I have about half enabled and half disabled in Jetpack. Jetpack is notorious for being a big reason for slow sites so disable as many as you can.

Then look at all your other plugins and try and eliminate any you do not use. Always try and install the ones with frequent updates, well-supported, and with good ratings if possible. Bad code from plugins can cause the biggest impact on speed. If you don’t have WP Smush.it installed, download and activate it. It reduces photo sizes. Another good plugin to help you identify ones that are causing problems is P3 (Plugin Performance Profiler) You can deactivate it when you don’t need to run test and only activate it when needed.

I would also highly recommend the wonderful and also free WP Optimize plugin. (Priority) It is very simple to install, activate, and use.  I simply use default settings and allow it to clean and optimize weekly. 

Assuming you managed to eliminate some useless plugins, run those benchmarks again and see if that helped. If your scores are still too slow, run the P3 plugin and try and identify what is taking the most time. Maybe there is better alternative you can try if P3 identifies one eating up all the time.

Step 2) Disable all your plugins and run those benchmarks scores again. If your score massively improves then you simply have to identify which one is causing the slowness.

Step 2A) If your scores didn’t improve that much even with all plugins disabled try switching to a theme like Twenty Eleven, Twenty Fourteen or Twenty Ten and run the benchmarks again. If your benchmark score greatly jumps up your theme may be causing the issue. Themes are the second biggest cause of speed issues.

Step 3) Identify the plugin causing the problems. If you have a lot of plugins you can try enabling them in very small sets of three at a time. Once the slowness reappears you can then disable just those until you narrow it down further. Run benchmarks every time you enable some to see if you can identify the problem one.

With all the thousands of plugins available from WordPress directory there is likely a better alternative or workaround you can use. You can also go to the WordPress support forum for that plugin and ask the developer or other users if this is a known issue with a solution. Some plugins become Abandonware which means the developer might have simply moved on to other projects and will not update it any further. Try and stick with plugins that are still getting updates and good reviews.

Hopefully one or more of these tips solved your issue. If it didn’t then you need to go to the WordPress support forum and try and get more specific fixes for your site.

speed

Your site is not Slow but You want it to Be Even Faster

Once you have fixed all your front-end issues that you can possibly fix, there are still other ways to make your site a speed demon. I use GoDaddy as my host and a Free Amazon CDN (Content Delivery Network) Some people claim GoDaddy is known to be slow for WordPress hosting but I do not think that is true. I am getting better scores than some friends paying far more at so called WordPress optimized hosting. If you do not want to change hosts then here are a few free things you can do to massively boost your speed.

W3 Cache is Essential to a Fast Website

Download and activate W3 cache.There are  many good guides out there and I ended up reading two or three and just played around with settings until I was happy with the speed. Some guides also leave off tips others include which is why reading two or three can help make it easier. Youtube also has some good video tutorials so pick one you like.

In my experience the W3 Cache setting that caused the biggest boost was found under Minify settings> JS File Management for my theme and also under CSS File management. You can use the Help Wizard at the top of the Minify Settings page to create a set of rules for the theme you use. Enabling rules in this section may cause some weird things to happen and not display properly so you might have to disable rules until your site works normally again. Try and find a good guide for rules for your theme. I just did enabled all rules then disabled them until my site was working normally again. But most guides seem to gloss over these two sections which I think is a mistake. I have 19 JS File management rules enabled, some in head, some after body. I also have 10 CSS File management rules enabled just to give you an idea.

Here are some  guides I used to optimize W3. Different guides might make different suggestions so it is really trial and error. It may seem overwhelming at first but a little persistence and effort all pay big dividends. Some sections might be slightly different since they use slightly older versions of W3.

With all my plugins besides W3 disabled I scored 97 Desktop and 89 Mobile under the Google PageSpeed test. I am sacrificing some speed because my site is much more functional with the plugins I chose to keep. I mention this just so you can compare your score. 

Guide to W3 Total Cache

Ideal W3 Total cache Settings

Video Tutorial 

Enable a CDN for your Website

There are many choices and also CDN specific instructions depending on who you choose. I went with Amazon Cloudfront because it is free.  The downside is it is a little trickier to set up than paid CDN’s but once it is configured you are done. I had to read several guides to figure out how to create my account on Amazon then also how to configure it to work with W3. Go slowly with your CloudFront setup and make sure you get it set up correctly.

I will give you the links to a few guides. There are two areas of settings to configure for your CDN. General and CDN setting within the W3 settings. Under General settings I decided to use the Generic Mirror Option since that seemed to be the easiest for me to get working. I was never able to get the ones that specifically say Amazon CloudFront working,

These Guides should get you up and running with a CDN to really speed things up. It might seem difficult at first but it really isn’t. Stick with it and once your CDN is working and W3 cache is tweaked and optimized you should get a huge speed boost. Once you understand what you are doing the whole process really only takes about 10 or 15 minutes,

Amazon Cloudfront CDN with W3 Total Cache WordPress

Activating Amazon CloudFront

Supercharge Your Website with Amazon CloudFront

Final Tips

These remaining tips I saved for the end because they are a bit more advanced. They are not essential but worth trying if you think you can handle it.

Replace PHP with static HTML, when necessary. Simply click that link and it will open a very good guide which explains the process. 

Optimize your homepage to load quickly. 

Things that you can do include:

  • Show excerpts instead of full posts
  • Reduce the number of posts on the page (I like showing between 5-7)
  • Remove unnecessary sharing widgets from the home page (include them only in posts)
  • Remove inactive plugins and widgets that you don’t need
  • Keep in minimal! Readers are here for content, not 8,000 widgets on the homepage
Overall, a clean and focused homepage design will help your page not only look good, but load quicker as well.

Disable hotlinking and leeching of your content

Hotlinking is a form of bandwidth “theft.” It occurs when other sites direct link to the images on your site from their articles making your server load increasingly high.

This can add up as more and more people “scrape” your posts or your site (and especially images) become more popular, as must do if you create custom images for your site on a regular basis.

Place this code in your root .htaccess file:

disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?gwmac.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/gwmac[NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

You’ll notice I included my feed (from FeedBurner), you’ll need to replace it with your feed’s name, otherwise your images won’t appear correctly there.

Add an expires header to static resources

An Expires header is a way to specify a time far enough in the future so that the clients (browsers) don’t have to re-fetch any static content (such as css file, javascript, images etc).

This way can cut your load time significantly for your regular users.

You need to copy and paste the following code in your root .htaccess file:

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000

The above numbers are set for a month (in seconds), you can change them as you wish.

Control the amount of post revisions stored

I saved this post to draft about 8 times.

WordPress, left to its own devices, would store every single one of these drafts, indefinitely.

Now, when this post is done and published, why would I need all of those drafts stored? Delete revisions once you are happy with final copy. 

Turn off pingbacks and trackbacks

By default, WordPress interacts with other blogs that are equipped with pingbacks and trackbacks.

Every time another blog mentions you, it notifies your site, which in turn updates data on the post. Turning this off will not destroy the backlinks to your site, just the setting that generates a lot of work for your site.

For more detail, read this explanation of WordPress Pingbacks, Trackbacks and Linkbacks.

Hopefully one or more of these tips will help speed up your site. It can be very frustrating to try and guess what is making your site slow but with a little elbow grease, persistence and a lot of trial and error you will figure it out.

With most of my plugins disabled I managed to score a 97 Goggle Desktop and 91 for mobile but I made a compromise for a slightly slower site because I felt the plugins I chose to keep were essential to the functionality of my site. You will likely also decide to sacrifice a little speed for the added value that some plugins provide.

I would love to hear any other tips you may have below in the comments. I would also like to hear if any of these tips helped solve your problems or give you a speed boost.


About The Author

Reply