Is your WordPress site starting to become slow?
Search engines look at page speed when calculating where your site should be in their search results, and visitors have less patience with slow loading websites each year. Around 10-15 years ago it was often recommended to have your page load within four seconds – which nowadays would like watching grass grow. Some of the tips we gathered here are specific for WordPress, but similar solutions often exist for other blog and CMS platforms. The tips on this page are besides basic things such as getting fast WordPress hosting.
Disable unused plugins
If you have a WordPress with a few years on its neck, you have probably installed quite a few plugins, tried them out, and then forgotten about some. Before you go any further, go through your installed plugins and disable everything you don’t use. Also, have a look at the ones that are in use, and consider if they are actually needed. We recommend temporarily installing P3 Profiler from GoDaddy while doing this, to give you an idea of which plugins are using the most resources. If you notice that a plugin you absolutely need is using a lot of resources, consider switching to a similar one, and don’t forget to read the reviews and check that it works with your current WordPress version.
Only load plugins on pages where they are used
One “feature” in WordPress is that it loads all enabled plugins with every page, whether or not the page actually needs it or not. If you for example have a contact page, a gallery page and a quiz page each needing their own plugin, WordPress will load everything for all three plugins on all three pages, even though they only use one plugin in the actual content for each page.
With some plugins, such as Contact Form 7, you can edit a couple of PHP files to disable the plugin for most pages, and only load the scripts when on a specific page, such as the contact page. However, most plugins don’t have this option, or you might not have the experience to edit PHP files. If you have many plugins which are only used on one or two pages each we recommend adding Plugin Organizer to your WordPress site, which lets you switch off or on any plugin for the pages where you want them. You simply change the global settings to turn off a plugin by default, and then go to the page where you want to use it and switch on there. Even if you stop reading here, by doing this step you could already save a lot of bandwidth and get much improved page speed.
Minify and combine resources
Another issue you often see for slow websites is the amount of files to download for each page. You might have 50-100 files on a single page without knowing it, but there’s a solution to this as well. Most of the good minifier plugins will also give you the option to combine the minified scripts. There are cases where you might not want to do this, but most often it will show improvements.
One of the biggest issues is often having many large images, which tend to take up 50-75% of the total download on a website. A major reason for this is usually not having optimized images and removed unnecessary bytes from the image files. One of our favorite WordPress plugins right now is one called WP Smush.it, which goes through all your images and takes away the information you don’t need to show. The extra information could be about the camera and time for a photo, or about the software if a program such as PhotoShop was used to create the image. The plugin has failed on rare occasions in the past, but if you notice something going wrong it’s quite easy restoring the original images with a plugin called ‘Regenerate Thumbnails’.
If you do have pages with many images, we also recommend looking at plugins for “Lazy Loading”, which basically makes the images load only when scrolling down to have them come into view. This way, you can speed up the initial page load without actually changing anything on the page. We recently tested a3 Lazy Load on a page with almost a hundred images, and it went down from taking almost 7 seconds to loading in less than two seconds. There are a few other plugins for this as well, and you should always check if something you install is compatible with your current version of WordPress.
When it comes to images it might also be a good idea to look at if your template is loading the right size in the right place. We recently encountered a theme which was loading all images with original size, then letting the CSS handle resizing even when all images were shown with the dimensions – this included loading images with a width of 1250 pixels shown at 250 pixels, which meant images six times the needed size were loaded, and slowing down the site quite a bit. Adding image sizes requires you to add a single line of code in the functions.php file for your theme. Ask your friendly theme designer or developer if you don’t know how to do this, and tell them you want to add a new default image size (the function is called add_image_size()) .
Cache your pages
Every time you ask WordPress for a page, it goes through quite a few steps before sending something back. In some cases the browser even asks for resources it might already have, such as images, scripts and stylesheet files, which can actually be saved by the browser and reused on multiple pages, which is called browser caching. A common example would be a logo, which tends to be used on all pages of a website, and can therefore be cached by the browser to avoid unnecessary requests to the website.
On the server side, there are quite a few things happening which can be saved, or cached, in a similar way. To avoid most of the extra steps WordPress might take to build a page, you can install a plugin to cache your pages. Popular options include ‘W3 Total Cache’, ‘WP Super Cache’ and ‘Zen Cache’ – which one is best for you depends on circumstances, and all are reliable and kept up to date. WP Super Cache seems to be the most popular one, and includes settings for advanced users, which is also true for the other two, and all have a simple setup with default recommended options.
Test your pages
Other free testing tools include WebPageTest.org, Pingdom and GTmetrix, which all give you details about what is slow and suggestions on how to fix issues. To get an idea of load times you can also use browser plugins such as Firebug - for an overview just have a look on the Net tab to see how long it takes for different resources to load.
Once you get started improving page speeds you'll notice it's an ongoing project, and you can always find more things to improve.
Good luck, and let us know how you fare in the comments!