How to Replace the WordPress Cron with a Real Cron Job
At times, you may want to substitute constant file execution with a real cron job. First, you need to disable the script to be executed every time someone loads one of your pages. To do this, open the wp-config.php file in your main WordPress folder and add the following line before the "/* That's all, stop editing! Happy blogging. */" line:
define('DISABLE_WP_CRON', true);
Once you do that, you need to setup a real cron job and execute the wp-cron.php file with it. You don't want to trigger it too often - 30 minutes should be fine for most of the websites. To do this, login to your cPanel and go to the Cron jobs tool located in the Advanced section.
Then, add the following command to be executed every 30 minutes:
wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Replace yourdomain.com with your actual domain name. The Cron jobs tool has some of the most common schedules preset, so you can just select Every 30 minutes from the minutes drop-down and place a " * " symbol in the others.
Remember to click on "Add New Cronjob" to save the changes.
define('DISABLE_WP_CRON', true);
Once you do that, you need to setup a real cron job and execute the wp-cron.php file with it. You don't want to trigger it too often - 30 minutes should be fine for most of the websites. To do this, login to your cPanel and go to the Cron jobs tool located in the Advanced section.
Then, add the following command to be executed every 30 minutes:
wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Replace yourdomain.com with your actual domain name. The Cron jobs tool has some of the most common schedules preset, so you can just select Every 30 minutes from the minutes drop-down and place a " * " symbol in the others.
Remember to click on "Add New Cronjob" to save the changes.
Updated on: 03/01/2019
Thank you!