I really don’t know why it took me so long to write this guide… I mean, site speed is one of the most important characteristics for any online magazine, blog, product site, or any other website for that matter. I would even risk saying that it’s more important than the content itself. Why?
Quite simply, if someone doesn’t feel like waiting long enough for your content to load then they won’t have the chance to see it.
Besides, site speed is now a known SEO factor, which means (in short) that the faster your site is, the better ranking it gets.
Actually, I don’t think that I need to convince you to the importance of having a fast site, you probably realize the need as well as I do. Moving on, then.
This guide presents every important aspect of site speed as related to WordPress that I know of. The things covered here talk about plugins, database optimization, images, site files, and more.
Also, I’ve tried to make this a single complete resource, which means that you can go ahead and apply every piece of advice here to a single site, but you can also pick just some individual elements and implement only them.
So, let’s get this thing going with:
Analyzing your site speed
Analyzing site speed seems like a straightforward task, when it’s actually very VERY hard to do accurately.
Here are some factors that can impact a single speed test:
- The place from which the test is being performed.
- Current network conditions.
- Current traffic load of the website.
- Current day and time.
- Current traffic load of your test provider.
… and probably a number of other factors, but I guess this short set paints the picture quite well.
What I’m trying to say is that just because some service says that your site takes 1.61 s to load, doesn’t actually mean that it’s the case.
Therefore, some general rules of speed testing are:
- How long the site loads on your computer doesn’t matter (unless you’re a member of your site’s target audience).
- Use only quality testers and run multiple tests at different times, and then get the average value.
- Perform tests from your target audience’s location.
My favorite tool for this kind of fun is the speed tester (FPT – Full Page Test) by Pingdom Tools.
FPT allows you to select the location that the test will be performed from. At the time of writing the available locations are: Amsterdam, New York City, and Dallas.
(Note. If you have a site targeted towards audiences outside of the US or Europe, you’ll have to find a different tool.)
FPT provides a big number of different metrics, just in case you want to get a little more in depth into the whole thing, but if you don’t, you can just look at the overall load time. Once you have this value, repeat the test a number of times (10 or so) to get the average load time. This is your starting point.
Now, feel free to disagree, but from my point of view, everything above 3 s is slow. 1-2 s is okay. Below 1 s is great and doesn’t actually require any further optimizations.
(Just for fun, you can also play around with a tool called “which loads faster” – compare two sites against each other.)
Let’s move on to the actual things you can do to improve your site’s performance:
THE STARTER PACK
This is what I call the starter pack because it’s actually a set of things that’s best to do when you’re first launching your site. Doing it later will require a bit more work (but it’s still possible).
Your web host
Your web host is the most important factor when it comes to site speed. No surprise here, right?
This means two things: (1) you should be very careful when selecting a web host before you launch your site, and (2) you should seriously consider changing your current web host if you think it’s not performing well.
Switching to a new host isn’t actually difficult at all, and you can do it within an hour or two. Nothing to be afraid of. You can check my other post for advice – how to move your WordPress blog to a new host.
When it comes to selecting a host, I advise you to focus on two main things:
- The overall reputation of the web host you’re about to pick (online reviews, and such).
- The possibility to get a server near your target market’s location (for instance, if your audience is based in Europe, get a server in Europe, etc.).
I don’t want to endorse any specific hosting companies here, so you’re on your own. But if you’ve read my other posts then you already know what my favorite one is.
Your theme is the second element in the “starter pack” of speed optimization.
Setting the looks aside, your theme should be quality made and optimized right from the get-go. Modern themes have dozens of separate files that offer a number of functionalities and often connect to many external services. Only the top theme developers can guarantee good performance and quality service.
Guess what is the best place to get some quality and optimized themes?
That’s correct, you’re already here.
Also, feel free to visit one of my guest posts at ProBlogger to get a bit more in-depth advice – selecting a WordPress theme.
That’s it for the “starter pack,” let’s move on.
THE BASIC PACK
The basic pack is a set of things you should start your speed optimizations with. There’s nothing difficult here and (almost) no coding.
Cleaning up your plugin closet
Plugins consume your server’s resources, your bandwidth, and cause your site to load slower. As simple as this.
Therefore, the general rule is this: Delete the plugins you don’t need.
And the other rule is: Delete slow plugins and get faster alternatives.
The first rule is pretty easy to grasp and doesn’t require any further explanations, so let’s focus on the second one – deleting slow plugins.
First of all, how do you know which plugins are slow? Simple, you do it by installing another plugin!
The one I have in mind is called P3 (Plugin Performance Profiler).
This is a really cool piece of software engineering. It takes a look at the loading process of your site, and breaks it down into individual plugins you have installed. As a result, you get a report containing individual loading times for each plugin.
Once you have this data, you can decide to either remove certain plugins altogether or find some quicker alternatives.
What’s interesting, the plugins can account for even 60% of your site’s total load time. Take a look at this example graph (my site):
… will probably have to think about removing Relevanssi and finding an alternative. Also, take a look at Jetpack – the most hyped plugin in the official directory … not the fastest operating thing in the world, is it?
Another thing worth mentioning when it comes to plugins in general is that you shouldn’t have too many in total. The fact is that you don’t really need every cool piece of functionality out there. Just focus on the important stuff – things that improve the overall user experience.
Selective plugin activation
One final piece of general plugin advice I have for you is that you don’t need to have all plugins activated at all times. There are plugins that you use only occasionally (ones that don’t provide any user-visible content).
A great example of such a plugin is P3 described above – you only need it when doing a scan.
Some other examples:
- Backup plugins. But be careful here. If you’re using scheduled backups then you need them activated at all times. If you’re just doing manual backups then they can be deactivated.
- Security scan plugins. Things like Sucuri scans and other.
- Optimization and clean up plugins. Plugins for optimizing your database and other aspects of your site.
Getting even more plugins!
Since I’ve spent a fair amount of time explaining how important it is to have just a small number of plugins, now is a good moment to tell you that you need to get even more of them! Bear with me, I promise this will all make sense in the big picture.
Two plugins I’d like to recommend:
A great image optimization plugin. Especially useful if you’re using pictures to go alongside your posts/content.
The plugin takes every image you upload through the Media Library and runs it through the smush.it tool. As a result, you get an optimized version of your image (no loss of quality). On average, you can make every image at least 10-20% smaller (in file size).
Basically, the less disk space your images occupy, the less bandwidth your site uses. And the less bandwidth your site uses, the faster it loads.
Another plugin for image optimization. However, I advise you to install it only if you use a lot of images in individual posts you publish (if you publish a lot of list posts, or a have a photo blog, or anything else like that).
The plugin uses the lazy load concept which loads a given image only when it’s visible in the current viewport (visible on the screen). It uses jQuery.sonar to do so.
However, if your blog is not that image-heavy, this plugin won’t be very helpful. And it will impact the overall site speed, which P3 will surely let you know of.
Optimizing your database
The database is basically what runs your website. That’s why optimizing your database can have a significant impact on your site speed.
The general idea is to: optimize the general structure of tables, get rid of all the unused post revisions, remove spam comments, remove orphan meta data, and clean WordPress core tables.
If you’re somewhat proficient with MySQL, you can do it manually through phpMyAdmin, but you can also go the easy way and get yourself some more plugins! (Activate them selectively like I described above.)
Two alternatives (choose one):
- WP-Optimize. It helps you to remove revisions, drafts (be careful), auto drafts, moderated comments, spam comments, trash comments, orphan post meta, orphan comment meta, orphan relationships, dashboard transient feed.
- WP Clean Up. Basically, does the same things. So you can go with your own preference when choosing one of these plugins.
Also, consider disabling the post revisions functionality altogether. You can do it by adding this line to your wp-config.php file:
THE ADVANCED PACK
I’m calling the following set of things advanced, but implementing them isn’t actually more difficult than the basic pack … what’s advanced is the nature of these optimizations itself. Anyway, three things I want to discuss here.
In short, caching is a mechanism that allows your site to execute its source files only once and then to display the results to every visitor who comes by. This makes everything work much much faster than usual.
The best thing is that you don’t necessarily have to be a developer to enable caching on your WordPress site. The only thing you need is a plugin.
Even though there are a number of caching plugins available I advise you to go with W3 Total Cache (currently downloaded more than 1,300,000 times).
The plugin is recommended by a number of hosting providers including HostGator, Page.ly, and WP Engine. It offers an exceptional range of features, and on top of that it’s also fully functional running on the default settings. This means that you can just get it, push the activate button, and you’re good to go.
Using a CDN
CDN stands for Content Delivery Network. Basically, a CDN is a network of servers deployed in multiple data centers. What this means for your WordPress site is that you can have multiple instances of your site’s content distributed across different servers, and then the server that’s closest to your visitors’ location will deliver it on demand.
From my point of view, this is the ultimate trick to speed up your site.
The only downside is that you need to sign up for a CDN service first, and it usually requires some additional investments.
Note. You can configure any CDN through the W3 Total Cache plugin – yet another functionality it has to offer. For more info on CDN (and a how-to guide), feel free to check out my other post – using a CDN with WordPress.
THE DEVELOPER PACK
Finally, the developer pack. The fact is that there are tens of different things you can do to improve your site’s speed if you’re a WordPress developer and know your way around the source code, but what I have for you today are just two tips.
The homepage is your most important page. It’s the most visited page; the page that your visitors usually see first; and also the one that Google sees and analyzes first when determining your site speed.
To put it simply, optimizing your homepage can have a huge impact on your overall performance.
Some things you can do:
- Tweak the design to use a minimal number of elements. The less there are, the faster the page loads.
- Make sure that every image is optimized to the fullest.
- Use a small number of widgets (widgets slow things down too).
- Use a minimal number of plugin content on the homepage (things like Twitter boxes and so on).
- Try to reduce the amount of content in general. Be careful here, though. Your homepage obviously needs content, but instead of displaying 10 latest posts, for example, you can go by with displaying just five.
- Anything else? Feel free to let me know in the comments if you have some ideas for other tweaks.
Using simple hacks
WordPress has a built-in mechanism that allows you to add some simple functionalities without using any plugins. I think that you should take advantage of this to the fullest whenever possible.
For instance, don’t use plugins for basic, simple stuff that can be done with just a couple of lines of code. Some examples for your inspiration:
- displaying Twitter streams or any other social media boxes (can be easily done by hand),
- including tracking codes (Google Analytics and others),
- including ad codes (Google AdSense and others).
I guess that’s all for my guide to speeding up WordPress. Probably more than enough tasks here to keep you occupied for a while. However, please comment and share your own suggestions. Are there any tweaks you’d like to add to this guide? Also, is your WordPress site optimized for speed?