WordPress Performance Tip: Controlling Cronjobs

So, your blog is growing fast or you’re worried that your visitors will start increasing quickly but your WordPress based website or blog is slowly starting to slow down. You’re panicking and you start to get worried that your rankings will start falling down, visitors will get frustrated at your site and your site might possibly go down.

Well, we’re here to give you a simple and quick tip to reduce the resource usage of your WordPress blog while increasing the overall performance due to the decreased load that your blog will generate, all you need is 5 minutes and FTP access to your blog.

The wp-cron.php file runs with every single page load by default on WordPress blogs, which means that for every 1 request you get, you generate another one. This effectively translates to 1000 page views are actually making 2000 requests, which doesn’t make sense!

You see, WordPress was designed to be extremely easy to use, therefore, this easy to use system was put in place under the assumption that it was plug and play, because you never had to worry about it before. However, they assume once your traffic gets busy, you’d likely take care of it anyways.

Before we start, make sure that you’re comfortable with your using FTP and editing PHP files. Also, you want to always take backups of your website and files before making any changes to always go back if you have any problems.

  1. Disable the wp-cron.php by adding the following line anywhere in your wp-config.php file. You should put this line right after the <?php line.
    define('DISABLE_WP_CRON', true);
  2. Now, we’ve disabled the wp-cron.php, but some of your plugnis most likely rely on it, not to worry, all you have to do is create a cronjob with the following command.
    wget –q http://mydomain.com/wp-cron.php -O /dev/null

    If you’re using cPanel, you can look at the documentation on how to create a cronjob right here.

Voilà. Your website’s resource usage has effectively been cut in half and now your server will start performing much better overall. We’ll continue to post quick performance tips from time to time, so make sure to keep up with our blog!