WordPress Performance Tip: Controlling Cronjobs
So, your blog is growing fast or you are worried that your visitors will start increasing quickly but your WordPress based website or blog is slowly starting to slow down. You are 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 are 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 does not 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 would likely take care of it anyways.
Before we start, make sure that you are 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.
- 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.
<?php
define('DISABLE_WP_CRON', true);
?>
- Now, we have 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
Voila! Your website’s resource usage has effectively been cut in half and now your server will start performing much better overall. We will continue to post quick performance tips from time to time, so make sure to keep up with our blog!
Don’t forget to follow us on Twitter for news, updates and announcements – @vexxhost.