imagebigger

If your site takes an age to load, in the words of Jeremy Clarkson, that’s not good. You don’t want to wear on your reader’s patience before they’ve even started reading.

In this post we’ll explore ten ways to speed up your site, with tricks ranging from easy to even easier; none of the stuff in this post is difficult, so there’s no excuse for a slow-loading blog after reading this!

1. Delete Any Unwanted Plugins

If your site is loading slowly, look at how many plugins you’re using. If the answer is more than ten, look at the plugins you’re using and ask yourself whether you can integrate them directly into your theme.

While you’re at it, also ask yourself whether you really need the plugin. If you can do without it, do.

2. Remove Unnecessary PHP Tags

If you’re using a theme that you didn’t make yourself, then chances are it’s full of php that doesn’t need to be there. For example, your header could have something like this:

This is telling WordPress to get the stylesheet url every single time someone loads your page. You can very easily replace this with something like this: (Remember to replace yoursite.com with your address).

This is just one example – there are many many more times you can do this – have a hunt round your header.php and other theme files and you’ll be amazed at the number of unnecessary queries you can eliminate. We have a list of 13 of the most common un-needed tags here.

3. Use WP Super Cache

One of the better known techniques for speeding up WordPress is to install the WP Super Cache plugin. It caches your site for super-quick loading. It’s as simple as that. Install it and forget about it (and then promptly remember it when you wonder why your design changes aren’t showing next time you edit your theme files!).

4. Optimise Your Database

You’d be surprised how much you can increase your load time simply by optimising your database. As always, you could do it manually or just get a plugin that does it for you!

The manual way. This is super easy, as I explained on my blog: login to cPanel, find phpMyAdmin, select your database, click ‘check all’ at the bottom of the page and then in the drop down box in the middle of the page (see the image below), select ‘Optimize database’. And you’re done.

optimise

The other option is to use a plugin: the Optimize DB plugin from yoast.com does what it says on the box.

5. Optimise Your Images

If images aren’t optimised, both your blog’s bandwidth and load time will be affected. Both are bad. The solution? Optimise your images. It’s easier than you may think; in Photoshop click ‘save for web’ under the file menu or in the free GIMP, save the file as a .jpg and you’ll automatically be given the option to compress your image.

As a benchmark, although obviously depending on what the image is, on my blog I aim for in-post images to be 40kb or less (although don’t sacrifice quality too much!).

If for whatever reason you can’t use an image editor, all is not lost! Yahoo have a free service called smush.it that you can point at a web page and it’ll optimise the images.

6. Compress your CSS and JavaScript

Again, something that is very easy to do: compress your CSS and put your JavaScript into a single file.

To compress your CSS, you can use an online tool, such as styleneat.com (see the image below), which will get rid of the white spacing and neaten everything up. You might not notice any difference to start off with , but it will make a difference to your blog’s load speed; these things all add up.

Something else do is to put all of your JavaScript into a single file and then load it at the bottom of the page (in the footer.php file). This ensures that the styling is loaded first, then any fancy JavaScript you’ve got loads last.

styleneat

7. Disable Hotlinking

As I said earlier, if your images aren’t optimised then your using up bandwidth unnecessarily. It’s bad enough having to keep images optimised for your own server’s sake, but say someone else copied and pasted the url of the image, putting your images on their site?!

That’s called hotlinking, and via the .htaccess file (which you’ll find in your root directory), disabling hotlinking is easy.

First, backup your .htaccess file. I can’t stress how important that is! Next, add the lines of code below, changing the appropriate lines to suit your blog. The last line is an image that will display instead – how about an advert for your site?

1.#disable hotlinking of images with forbidden or custom image option
2.RewriteEngine on
3.RewriteCond %{HTTP_REFERER} !^$
4.RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
5.#RewriteRule \.(gif|jpg)$ - [F]
6.RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/stealingisbad.gif [R,L]

Source – A to Z of WordPress .htaccess hacks.

8. Keep Spammers Away

The .htaccess file is a very useful tool (e.g. here’s some of the best htaccess tricks); it won’t just stop hotlinking, but it can also be used to keep spammers away by blocking referrers from certain sites. At this point, you’re probably thinking “great, pity it’d be impractical to implement this.”

Well, yes, it would be. The good news is that over at Perishable Press, Jeff has complied a list of over 8000 of the web’s spammiest referrers, which you can download here and just copy and paste into your .htaccess file.

How will this help your site load faster? If spammers aren’t getting onto your site then they aren’t using up your resources, freeing them up for everyone else to use, so the site loads faster. It will stop spammers from baraging your server with hundreds of requests. You can read the full explanation on the post at Perishable Press.

9. Turn Off Post Revisions

Post revisions, introduced in WordPress 2.6, haven’t been a big hit with everyone, especially those with single-author blogs. Why do they slow down your site?

Every single time you save a post, a new row is created in your wp_posts table, so if you save your post ten times, that’s ten new rows created.

Thankfully, as Lester Chan points out, it’s easy to turn off post revisions – add the following line to your wp-config.php file:

10. Your Thoughts and Additional Reading

A couple of other articles around the net to check out -

AndBreak.com: Guide to Speeding Up WordPress

WPCandy: 4 Simple Ways To Speed Up WordPress

Lorelle on WordPress: The 3 Easiest Ways to Speed Up WordPress

Yoast.com: Speed up WordPress, and clean it up too!Speed up WordPress, Increase WordPress Performance

Noupe.com: 13 Great WordPress Speed Tips and Tricks for MAX Performance

Everyone’s got their own ideas: what’s your favourite way to speed up WordPress? Leave a comment below.

Enjoy this post? You should follow me on Twitter!