Working With wp-cron.php in WordPress

wp-cron.php runs every time when a visitor visits a wordpress website. This puts a lot of extra load on your website in case your website has high traffic; especially in cash your website faces spike (sudden increase) in traffic. You need to run cron job when ever your website is updated. A simple solution to handel cron job on your website is to use this function at a specific interval instead of using it on every request. For this purpose cron job can be tackeled effeciently in following two steps.

1. Disabling wp-cron.php function

In your root folder i.e. public html directory of wordpress installation; you find wp-config.php you need to add following line to disable the default of the wp-cron.php function.


/**Disabling WP CRON Function */
define(‘DISABLE_WP_CRON’, ‘true’);

The best location to put this in wp-config is right after the use name of the wordpress database. (like following)



/** MySQL database username */
define(‘DB_USER’, ‘userna5_user’);
define(‘DISABLE_WP_CRON’, ‘true’);

/**Disabling WP CRON Function */
define(‘DISABLE_WP_CRON’, ‘true’);


2. Configuring Scheduled Crop Job

Now to run scheduled cron job the “Cron Job” option in wordpress is used in following simple steps

By logging into cPanle, sellect “Cron Job” and in Cron Job – “Add a new Cron job now by clicking on the dropdown menu for “Hour:” and set to “Every 3 hours (*/3)”. A screenshot of this step is given at the end.

Now at last step in command field you need to add following command.

cd /home/cpusrname/public_html; php -q wp-cron.php

Please note that after home you need to use your own cpusername of the specific website you’re working with.