Web Development

Speed Up WordPress

By October 30, 2017 No Comments

WordPress can be a very performant content management system. Although more often than not, WordPress administrators install too many plugins or bloated themes that get in the way of WordPress doing its job.

This article outlines a few ways that you can improve the performance of your WordPress website and make it load faster.

1. The basics

  • Theme – Ensure your WordPress theme is from a reputable company who produce good software. If you’re purchasing a theme – always ensure you read the support forum/comments for any complaints. Also review the demo site – does that load fast? If not, it’s probably a good indicator that you won’t be able to make it load quickly either.
  • Plugins – The more plugins your site has installed and activated, the more lines of code your site needs run through and execute. It’s always worth reviewing your plugins and cleaning up what you don’t need. Within the WordPress backend, browse to the Plugins screens and de-activate and/or uninstall any plugins that aren’t being used.
  • Hosting – Ensure your WordPress website is installed on a fast server by a reputable company, which is located in the same country as your end users. Spending $5 a month on hosting probably isn’t going to get you a very fast result.

2. Turn off the WordPress Cron

WordPress has a built in ‘virtual cron’ – essentially a job scheduler. On each and every page load, it checks this scheduler and run any tasks that have been queued.

Whilst WordPress needs to run these tasks, executing them on page load for a customer can dramatically slow down each page load – eg. consider how timely it is to warm the cache of each page in the site map.

We can turn off the WordPress virtual cron and instead tell WordPress to check/run the cron in the background every 30mins:

  • Turn off the virtual cron – in the wp-config.php file, add the following before the MySQL settings: define('DISABLE_WP_CRON', true);
  • Add a Cron Job to run every 30mins in cPanel:
    • cPanel > Cron Jobs
    • Select ‘Twice an hour’ from Common Settings
    • As the command, add /usr/bin/php /home/{{site_username}}/public_html/wp-cron.php >/dev/null 2>&1

3. Install a Cache Plugin

There’s a number of great WordPress Caching plugins available. For simplicity, we generally choose to install W3 Total Cache. We typically get results like the reduction of HTTP requests from 88 to 44, load time reduces from 2.91 to 1.97 and the initial PHP page load from 802ms to 376ms.

To get results like this, simply install the plugin then configure it within WordPress > Performance:

  • General Settings:
    • Page Cache > Enable
    • Minify > Enable
    • Database Cache > Enable
    • Object Cache > Enable
    • Browser Cache > Enable
  • Browser Cache:
    • Enable: Set expires header
    • Enable: Set cache control header
  • Page Cache:
    • Enable: Don’t cache pages for logged in users – we don’t want to cache the admin bar etc when users are logged in