Since many webmasters tend to disable the WordPress cron job for which always fails for various reasons, we would like to offer a solution to this end. This guide introduces the way to disable the WP cron and then replace it with a real cron job. Note that, we are going to set up the cron job via the most powerful cPanel.
Differences between WordPress Cron Job and Real Cron Job
WordPress Cron Job (wp-cron.php)
WordPress enables a virtual cron job to automate every task on website and that is a file called wp-cron.php. For example, it is possible to schedule when to publish a post, when to send an email notification, when to update a theme & plugin, and so on.
By default, the WordPress cron job starts to work when visitors access to your website. That cannot be controlled by users. For the websites with heavy traffic, an influx of requests will take large amount of server resource. That gives rise to slow page loading speed.
Real Cron Job
Users can take full control of the real cron job and schedule any tasks according to personal needs. The cron job works as scheduled instead of launching automatically. No matter for low-traffic sites or high-traffic sites, the real cron job only uses server resources within the recommended limits. That will never lead to large server load.
Disable WordPress Cron Job (wp-cron.php)
Scroll down to the bottom of this editor and insert the following line of code. Click “Save Button” to confirm the changes.
And now, you have successfully disable wp-cron.php on your website.
Set Up Real Cron Job
Having the virtual cron job disabled, you are required to set up real cron job manually. We are going to complete all settings via cPanel. Log into cPanel and go to Advanced > Cron Jobs. Here comes a list of options for cron job setup. Target the “Add a New Cron Job” section. This is where to determine how often the cron job works. Select the time interval as required.
The Common Settings field is used to set a time interval roughly. That can be once/twice per minute, day, month or year. After selecting an option from this field, you should jump to the Command area and enter a command as planned. If there is a need to set a specific working time for this new cron job. Customize the Minute, Hour, Day, Month and Weekday options as you want. Click “Add New Cron Job” button to confirm all settings.
A message shown as below indicates that you have successfully created a new cron job.
All cron jobs are shown in the “Current Cron Jobs” section. You are allowed to edit or delete any cron job in anytime. By the way, if there is a need to get an email notification once a cron job runs, turn to “Cron Email” section and enter your email address in the Email field.