How to Replace WP Cron with a Real Cron Job?

Replacing the standard WP Cron system with a real Cron Job on your server can improve the stability and performance of your site. WP Auto Republish especially benefits from this since it uses Cron heavily and runs many tasks asynchronously in order to avoid slowing down requests to your site.

Read more about Hooking WP-Cron Into the System Task Scheduler from the WordPress developer documentation.

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 );

When using WP Auto Republish we recommend setting the Cron interval time to not greater than 1 minute. That is * * * * * for the Cron interval setting.

Once you do that, you need to set up a real cron job and execute the wp-cron.php file with it. You don’t want to trigger it too often – 1 minute should be fine for most of the websites which are using WP Auto Republish Plugin. The command you should use is:

wget -q -O - https://YOUR_SITE_URL/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Replace YOUR_SITE_URL with your actual domain name. The Cron jobs tool has some of the most common schedules preset, so you can just select 1 Minute from the interval drop-down menu.

If you Host does not allows Cron Jobs, then you can use external Cron Job services like cron-job.org – Free cronjobs – from minutely to once a year. (cron-job.org). Just Open the website and Signup. Then Add a new Cron Job with 1 minute interval.