Twelve Ways to Massively Speed Up Your WordPress Site

Is your WordPress site loading slowly? There is a cool tool called Pingdom which creates waterfall charts so you can see exactly what is slowing down your site when it is loading.  It’s free and easy to use. After running all of my WordPress sites through Pingdom and doing lots of experiments and research, I’ve come up with these steps to massively speed up your WordPress site.

Before starting, I suggest running Pingdom on your site at least a few times to get a baseline of how long it takes to load.

Pingdom waterfall tool

Here are my top steps to a faster WordPress site:

1. Clean Up Your Plugins

Plugins are great.  It seems like almost anything you want to do with a WordPress site can be done with a plugin that someone has already written.  But, if you don’t realize the downside to plugins, it’s easy to go overboard.  The reality is that plugins can be the biggest contributor to delay in your site’s load time.

P3 Performance Profiler screenshot

If you don’t believe me, check out a plugin called P3 Performance Profiler (made by GoDaddy, but it’s good, believe me).  It generates some cool pie charts showing exactly how much delay each plugin is causing.  I was shocked to find out that 87% of the page load time of one of my sites was due to plugins!

If you look at your Pingdom waterfall chart, you’ll also see plugin files as a big culprit.  After seeing all of this data, I became a plugin minimalist and deleted any plugins that weren’t absolutely necessary for my site.  So go through your site and get rid of any unneeded plugins.  Think long and hard to see if you really need each one.  Be sure to test thoroughly when you’re done to make sure you haven’t accidentally deleted some feature you need in your site.

There is one plugin in particular that causes a ton of delay, which warrants its own section, up next.

2 . Clean up Jetpack

Jetpack is pretty controversial because on the one hand, it offers some pretty cool features (like the kickass CSS editor that I love and social network buttons), but on the other hand, it has a lot of bloat in terms of effect on load time.  You can see if you click the P3 Performance Profiler pie chart above that Jetpack is the number one contributor to plugin delay in my site (and that is after I’ve deactivated many of Jetpack’s features!)

Pingdom chart showing Jetpack delaysIf you run Pingdom on a site with Jetpack installed, you’ll notice how many times Jetpack files appear in your waterfall chart!  There are multiple JavaScript and CSS files associated with it many Jetpack modules, each causing a server call, the bane of fast websites.  See circled items at chart on left.  (One of the worst offenders is the CSS editor that I love so much).

So, if you’re not using any Jetpack features, uninstall it altogether.

If you are using Jetpack features, you should de-activate individual Jetpack modules! Turn off everything that you’re not using.  Unfortunately, many of the “big ticket” items in Jetpack, as far as load time delay is concerned, are things that I need for my site.  But, deactivate as much as you can.

The one exception, perhaps, is a Jetpack feature called PhotonPhoton is a Content Delivery Network for the photos on your site.  It provides a server to deliver these photos to your site while it’s loading, freeing up your server to do other things.  While this is pretty cool, I don’t have hard data to show how much it helps.  If your site doesn’t have a lot of photos, it might not be worthwhile.  Also, since it basically makes a copy of your photos on another server, it can cause strange things when you try to make updates.  The documentation says that if you update a photo and keep the same filename name, it won’t be updated in Photon, and your site won’t see it.  So, I leave it up to you to decide whether you want to use Photon or not.  Personally, I have it off because I don’t want to deal updating a photo a year from now and not having the site update, after I’ve forgotten that Photon could be causing the problem.  I could see myself wasting hours trying to figure that one out.

3. Compress Images

A big problem that I see on my clients’ websites is that they don’t compress their images before uploading to WordPress.  It is true that WordPress compresses images in many cases, there are cases where this isn’t the case.  The user might have chosen to display the full size version, or the theme might as well.

Run Pingdom and look for the big-ticket files that are being loaded, like images, and see if you can reduce the size of those. Make sure images are not bigger than they have to be.  Images from digital cameras are often 5000 pixels wide and 2MB to 5MB in size.  I usually compress them to be 1200 pixels wide with 80% quality, bringing them down to 200kB or less, a huge difference!

4. Clean Up Your Database

Among other things, P3 Performance Profiler tells you how many database calls your site makes.  In my case, it was a whopping 60 database calls!  I bet that’s not so unusual and may be on the low side.

I use a plugin called WP-Optimize to clean up my database.  WP-Optimize won’t reduce the number of database calls, but it should make them snappier.

WordPress stores a full version of your post or page every time you hit the “Save” button.  That can  mean you have hundreds of drafts of any one article saved in the database.  WP-Optimize will clean these off.  It will also get rid of spam comments.

I just ran this on a few of my sites and it reduced the size of my database by 30-50%.  If you haven’t ever cleaned up your database before, the savings might be even greater for you.

But, unlike the first three items on this list, I don’t have hard data to show faster load time after using this plugin.  It’s just too hard to measure.  I can’t prove it with data, but it makes sense intuitively that a smaller, cleaner database would be faster.  On the other hand, cleaning up the database probably provides the smallest speed improvement on this list, unless your database is really bloated.

Indeed, the plugin itself inherently causes some delay, but its contribution to load time is miniscule according to P3 Performance Profiler.  In the end, I believe the benefits are worth it, and you could always deactivate it after cleaning your database if you want.  At the very least, WP-Optimize will free up wasted database disk space and make your backups run quicker, which has some benefit.

5. Use a Caching Plugin

When done properly, caching can massively speed up your site, perhaps by a factor of two to ten times, on a slow site.  However, when done improperly it can massively slow down your site and cause a whole host of other problems including outright breaking your WordPress site.  Use carefully.

What is caching?  In the previous step, I said there were 60 database calls in one of my  home pages.  Caching will drastically reduce the number of database calls by storing your site as static HTML.  The speed improvement from doing this can be insane.

WP Fastest Cache

My new favorite caching plugin is WP Fastest Cache.  It’s simple to set up and gives great results.

A few caveats though. Caching, by its very nature, has some bad side-effects, namely, dynamic content might not update. I noticed that my Jetpack sidebar widget showing most popular articles never updated because it was cached. Commenting within the Jetpack gallery also didn’t work while caching was enabled.  Make sure to test your site thoroughly if you enable WP Fastest Cache.

WP Super Cache

The first caching plugin I tried was WP Super Cache, since it has great reviews.  At first, I was in awe at the speedup.  After testing for a day or so, I noticed that sometimes my site would take a long time to load (ten to twenty seconds) or not load at all (freeze at white screen in browser).  I am sure if there was some setting I had wrong, but at that point I lost patience and uninstalled it.  I was probably hasty, as WP Super Cache does have good reviews, as I’ve said.  On the other hand, there are also lots of people who reported that it slowed down or caused their sites to hang.  I was one of them.

W3 Total Cache

After removing WP Super Cache, I installed W3 Total Cache (which also has great reviews) and naively enabled all speedup options.  This massively slowed down my site as well.  After a lot of experimentation and testing, I found that in my case it was best to enable just one of the functions: “Page Caching (Disk: Enhanced)”.  Object caching and database caching caused my sites to slow down.

It turns out that many of the more advanced features require a lot of server expertise to set up, and may not be effective on shared hosting.  Thus, I was stuck with the bare-bones page caching feature.

But even then, the speedup was immediately apparent.  All I can say is “wow”.  I’d say it sped up the load time of my sites by a factor of at least two or more. If you look at the chart below, you’ll see a noticeable improvement in average load time compared to when caching was off. There are still peaks of slow load time (probably due to my cheap hosting), but the average page load time is faster and the best page load times are massively faster. The proof is in the pudding.

Site load times

But, this is literally after DAYS of testing the various options on it.  Save yourself some headaches and just enable page caching, at least to start with, and proceed with caution after that if you’re greedy for more speed.

One note, if you run P3 Performance Profiler with W3 Total Cache, you’ll notice that the number of database calls reported doesn’t go down.  I believe that’s because P3 Profiler turns caching off when doing its scans.

The Dangers of Caching

There is an insidious problem with caching that you need to be aware of.  Since caching involves making a copy of your pages, there could be some strange behavior when you make updates and things don’t update for the user.  Theoretically, the caching plugin should clear the cache and make a new “copy” of your page whenever you make an update, but I when I update content without clearing the cache, the changes don’t show up in iOS.  I know iOS has some “interesting” caching behavior of it’s own that might have complicated things. Clearing the cache manually just takes a button press, so it’s not a big deal once you know what’s going on.  If you don’t,  you could be pulling your hair out wondering why the site is not updating.  While these caching plugins are almost perfect, it’s just something to be aware of.  I would be very wary of enabling caching for a client’s site if they were not tech-savvy.

There are also some plugins that are not compatible with caching. For example, Jetpack’s email form won’t work with W3 Total Cache. You can get around this by disabling caching for that page.

6. Use a Content Delivery Network

Using a Content Delivery Network (CDN) means that your images will be loaded from a different server than the rest of your site, relieving your server of a lot of work (and delay). This can be helpful in sites with lots of images.

Jetpack has a built-in CDN called “Photon”. Simply activate it.  Your results will vary depending on the number and size of images on your site. In my real-world testing, I’ve gotten load time improvements of up to a second! However, you’d probably have to take a larger sample size over a longer period of time to get more accurate results.

There are some caveats. By introducing another server, you’re adding another potential source of unreliability.  If that server goes down, your images won’t load. I’ve seen this happen on rare occasions.

Also, remember to deactivate the feature if you’re changing images on your site. With it activated, the changes might not show up on the live site.

7. Remove Query Strings from your CSS and JS Files

Query strings are snippets of text added to the end of file names starting with a question mark.  Here is an example:

http://brianshim.com/webtricks/wp-includes/css/admin-bar.min.css?ver=5698cc36679216bc4595b761e096decb

These can prevent proxy caching servers from caching these files, resulting in unnecessary re-loads. Removing them can speed up your site after it is viewed for the first time.

Check your site’s HTML code to see if you have these query strings. If so, your site  might benefit from removing them.

Happily, there is a simple plugin that does this for you, Remove Query Strings from Static Resources. In my testing, simply installing and activating this plugin resulted in a 2-3 point increase in the site’s Pingdom performance grade (hey, every little bit helps).

A couple of caveats though. You should thoroughly test your site after installing this, as it can break certain types of code. Also, you should deactivate this plugin during development, because if you make changes to any CSS or JS files, they won’t get updated when you re-load the site.

8. Update PHP

Since first publishing this article, I’ve discovered another way to speed up WordPress.  My servers were running PHP5.3.  I heard that PHP5.4 was faster, so I decided to give it a whirl.  My main concerns were incompatibilities that would break my WordPress sites, but after the upgrade everything was fine.

Benchmark tests show that PHP5.4 is faster than PHP5.3.  For WordPress, the speed is increase is 9%.  It also uses less peak memory.  If you’re currently running PHP5.2, the benefits of upgrading might be even greater.

If you have shared hosting, check your hosting control panel for “PHP”. There is usually an option to upgrade there by simply checking a radio button.  Just test your sites thoroughly afterwards!

9. Update WordPress

There have also been speed improvements in various version of WordPress (especially in the area of reducing the number of database calls).  So, if you’re running a really old version of WordPress, you could see a speed improvement by going to the latest version.

10. Combine and Minify Files

When you run Pingom again, look for multiple CSS and Javascript file loads. For each file that your site loads, additional time is needed to make the server call.  So, combining multiple files into one will save on server overhead.

If you have big CSS and JavaScript files, you can “minify” those to get rid of all of the white space and comments. This is a bit more advanced, and probably won’t speed things up as much as compressing a 5BM image, so I’ll leave the details for you to investigate if you’re interested.

Also,  look for broken file references (code referencing files that are not there) and clean those up.

11. Change Hosts

Sometimes the problem is simply that your server is too slow. If you have cheap shared hosting, then your server’s CPU might be busy when someone visits your page.  It might not even start loading your page for several seconds (look at the first bar of the Pingdom waterfall chart), basically nullifying all of the efforts you’ve made, because it doesn’t matter how lean your site is if it hasn’t even started loading yet!

I recently switched a client from Bluehost to WP Engine, and the speedup was insane. Sites loaded in a few seconds instead of ten seconds or more!!!

In my experience, Inmotion also offers fast servers (relative to other shared hosting providers).  Believe it or not, I have all of my personal blogs on GoDaddy (including this one), and their servers are pretty good!

12. Use a Faster MySQL Server

MySQL database calls can be a big culprit when it comes to slowing down your site.  I’ve seen this first-hand: my static HTML sites (with no database) are often lightening-fast when my WordPress MySQL-based sites on the same server are massively dragging.  The big difference is that my static sites have no database calls.

If you don’t want to deal with caching, and you don’t want to deal with the setup headaches of a VPS, then one compromise that could have big bang for the buck is to get a faster MySQL server.  A friend of mine who has Media Temple (I believe that was what he had) told me that they offer an faster MySQL option for just a little more per month, and that massively sped up his site.  Unfortunately, not all hosting companies provide this option. If your hosting company doesn’t, then something to look into is Amazon Relational Database Service (RDS).  Basically, Amazon can give you cloud-based MySQL hosting.  I have not personally tried this, but it seems encouraging.

13. BONUS: Convert Your Site to a Static Site

There is one thing that you can do which will probably make a bigger improvement to your WordPress site’s load time than anything else on this list: converting it to a static site.  In my experiment, I converted a WordPress blog to a static site using the Simply Static plugin and load time went from six seconds on average to under one second. This type of performance increase is pretty insane, especially when you consider that the site is on cheap shared hosting.

So why not do it all of the time?  Well, there is a pretty big tradeoff, namely, that you can’t have any server-side dynamic content on the site.  This includes server submit forms, server-side commenting, server-side e-commerce functionality, events management, membership, and on…

BUT, this does work for purely informational websites like company online brochures or blogs. For commenting, you can use client-side solutions like Disqus.

So, this solution is not for every website by any means (that’s why I have it as a “bonus” tip), but if your site is purely informational, you might want to consider it. If you do it, your site will get also get massively improved reliability and security as a bonus.

Hope this has helped.  Let me know your ideas for speeding up WordPress! – Brian

17 thoughts on “Twelve Ways to Massively Speed Up Your WordPress Site

  1. Great post! Thank you. It took me all day but finally after following the instructions here my headache is gone and my website is faster and up again.

    1. Hi Bahawalpur,

      Sorry for the late answer. For a small number of images, I use paint.net (windows). For a large number of images, I use a program called Easy Thumbnails.

      Best,
      Brian

  2. Brian, great article there! I personally agree with your point in choosing the right web hosting. Have you tried our cloud hosting? We are http://www.dewaweb.com. We use onApp cloud, HP Blade Hardware, LiteSpeed Web Server (HTTP/2 ready), SSD storage, and MariaDB database. Please try and do some reviews how it performs supporting WordPress sites. We’d be glad to give free hosting for you to try.

    Our current datacenters are in Singapore and LA.

    Thank you.

  3. Great article! I noticed that Jetpack massively slowed down my WordPress dashboard but not the website on the client side. I had to remove it and while I miss some of the features, I love actually being able to get work done on the back end!

  4. Hi Brian, before I started using WP-Optimize and caching my websites the page speed varied massively. After getting them in place I could begin to see some consistency on page speed tests which is a massive plus point for me. Visitor retention went up, got more return visits and much lower bounce rate.

    Just need to transfer to a faster hosting provider now as shared hosting feels like it’s adding over a second on to load time.

    1. Hi John, that is a great point. I found the same thing: the Facebook Like button takes forever to load, especially if you display friends who like your page.

      Thanks for sharing!

      Thanks,
      Brian

  5. Great! i am looking for this one on hoe to speed up my wordpress, i alreay try and so faw so good. .thanks a lot.

  6. Brian,

    I have been a fan of yours for less that a week and have already implemented a number of your suggestions on two of my sites!

    This article alone has been a great benefit and inspired me to use Pingdom and to clean up my blog site at http://www.biz-zoom.com which I am now running as a brand new membership site. The s2M plugin does slow the site down but this will be something I will have to live with.

    I got rid of contact forms and a Poll plug in and any other unnecessary plugins and installed the WP-Optimize plugin and when used it showed me a savings, and all of these have increased my page speed noticeably. Once it starts paying I will likely change hosts also to speed it up even more.

    Thanks Brian. You rock man!

Leave a Comment or Ask a Question