Did you know 40% of people abandon a website that takes more than 3 seconds to load? Don’t have any idea of your site’s speed? Use GTMetrix to check the performance of your website, then take the steps below to make your site load faster!
1. Choosing a good host
Hosting is the foundation of a fast website. Even if you implement the steps below, you might not be able to get your site quite as fast as it should be. Some of the most popular hosts, like BlueHost, are notorious for slow sites. Moving to a better host (I recommend SiteGround) can make a huge difference in how quick your site loads.
2. Minifying files
Minifying means files are compressed to the smallest possible size. For example, CSS and JS files can contain a lot of white space. This white space is useful for humans when editing such files, but it’s unnecessary for computers. Removing the white space will make the file size smaller, and smaller files load faster. If you use a lot of large images, you absolutely need to optimize your images. You can use W3 Total Cache to minify other files.
Each time your website loads, the server has to do a bunch of complex and time consuming tasks. Caching saves the results of these tasks to temporary files. It’s similar to how you do math – in elementary school you had to calculate that 3 times 3 equals 9, but now you just know – it’s in your memory. The server can skip the tasks and just serve the temporary files from memory until something actually changes on your site.
Using W3 Total Cache to speed up your site
You can use the free W3 Total Cache plugin to minify files and enable caching on your site.
Easy settings for a quick win
Just turn on Page Caching and Browser Caching with the default settings.
The best settings differ from site to site, so it takes some experimenting to find the best settings for your site.
Don’t use Database Caching
There’s too high a risk that your site will get “weird”. Just optimizing your database (see step 4) will be enough.
Turn on “Set expires header”. Other than that, the default settings should do most of the work.
Object Cache can help speed up your site depending on the plugins you use, but it can also slow down your site. Turn it on, test it, and if it slows down your site, turn it off.
Enable Minify and start with the default settings in the General settings page for W3 Total Cache. Under CSS on the Minify settings page, set @import handling to Process.
Then test to see if your site looks right.
Doesn’t look right? Choose “Combine only” for CSS.
Functionality not working properly? Choose “Combine only” for JS.
Test again. If it still doesn’t work properly you can either choose to completely turn off minify/combine for CSS or JS, or to use manual settings and combine/minify files one by one.
4. Optimize your database
WordPress auto-saves A LOT. You really don’t need to keep all the revisions for every single post, nor trackbacks, pingbacks, trashed items and spam comments. Just as your computer gets slower when the hard drive is fragmented, your site can get slower when your WordPress database is bloated.
If you don’t want WordPress to save post revisions, you can turn it off or limit the amount of revisions by adding one line of code to your wp-config.php file. (This is in the root folder of your site, or in the folder WordPress is installed in).
Turn off post revisions completely:
Limit post revisions: (with 3 being whatever amount of revisions you want to keep)
Before we go on to clean up your database, back it up! Make sure there’s a recent backup of your database. We will be deleting stuff you no longer need, but just in case you’re actually missing something after the clean-up, back up your database.
Use WP-Optimize to clean up post revisions, spam comments, and lots of other extraneous information.
Before you first use it to clean your database, it can be fun to look at how large it actually is before cleaning and then again after cleaning. You can view it under ‘Tables’.
On the main ‘Optimizer’ view, it’s pretty straight-forward to clean up your database. Select the clean-up options you want, then click the Process button.
Don’t remove the unapproved comments if there might be any non-spam comments you haven’t approved yet!
Under ‘Settings’, you can set it to automatically clean your database every week, every other week or every month.
This plugin does not make a backup, so make sure you have scheduled backups running before you set a schedule for the database clean-up.
5. Audit your plugins
I’ve said before that you need to use as few plugins as possible. But just moving functionality from plugins into your theme doesn’t do anything for page speed, the same code is still loading. In WordPress, functionality is meant to be inside plugins, and themes are meant to take care of the visual part of your site.
That said, it does help your site speed to remove plugins you don’t really use or need. Go through your list of installed plugins once in a while and remove the ones you don’t need any longer.
All done? Check your site speed again in GTMetrix, then let me know in the comments how much faster your site is!