How to Setup Real Cron job on WordPress on your Shared Hosting Account

Why use Real Cron job vs the scripted one?

I’m writing this because I realized the dates on my posts were not updating. This scripted cronjob was not working, instead I would use a real linxu command line cron job. Cron jobs keep your linux machine clean, because they clear cache and freeup memory. The error logs get bigger and bigger. By using cron job one can clean their linux servers hard drive. Less reading for the linux server. Hence faster run website.
 

First open wp-config.php using ftp or file manager.

type in this line of code in the file:

define( 'DISABLE_WP_CRON', true );

Save and your done with this part. Next.

  1. Log into Cpanel
  2. Under Advanced, click on Cron Jobs
  3. Under Add New Cron Job, choose “Once an hour” for Common Settings
  4. Enter this command [replace yoursite with your own domain name]
    wget -q -O – http://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  5. click Add New Cron Job

cpanel-wp-cron

 
This part you may or may not have cron job email you if the cron job is successful or fails. I would recommend you put it one for a day. If it’s all fine and dandy. I would just turn it off because cron jobs are automatic.

Conclusion:

Be careful of using cron job less than 15 minute intervals your webhost might be against it. So read the rules  before you do too quick of cron jobs. Plus cron job are scheduled automatic tasks.