Disable WordPress Cron and Enable Real Cron in 2 simple steps
- Disable WordPress Cron in wp-config.php with define(‘DISABLE_WP_CRON’, true);
- Add a real cron with wget -q -O – https://example.com/wp-cron.php?doing_wp_cron >/dev/null
What is WordPress Cron?
WordPress Cron is system to mimic real cron. Real cron is basically a task scheduler. In other words, its a system built in to make sure that automated events take place. For instance, if you’ve set a post to be published at a future date, or if you’re using a WordPress plugin for backups which must run at a certain time each day, WordPress cron will publish your post, or start other jobs at the correct time.
WordPress Cron runs when someone loads a page on your website. In other words, when someone lands on any page of your site, WordPress first runs the WP-Cron in the background.
Problems with WordPress Cron
As mentioned above, WordPress Cron runs when someone loads any page on your site. The problems with this are different, depending on whether you have a high traffic site or a low traffic site.
If you have a high traffic site then each time a visitor lands on one of your pages, WP-Cron is called. If you have 500 people at a time on your site and each one clicks through to 3 pages, that’s WP-Cron being called 1500 times! If your server has a low number of PHP workers or PHP threads then this could be a real drain and could cause the white page of death.
If you have a low traffic site then there’s a chance that scheduled events could be missed. For instance, if you have a newsletter scheduled to be sent 1 hour before your live webinar, but no one visits your page, then that newsletter never gets sent and your webinar gets no visitors. Boo WP-Cron!
Fortunately, its simple to disable WordPress Cron and enable real cron and I’m going to show you exactly how below.
How to Disable WordPress Cron and Enable Real Cron
There are two simple steps to enable real cron in place of WordPress Cron with WPTachyon’s Managed WordPress Hosting.
Step 1: Disable WordPress Cron
To disable WordPress Cron open your wp-config.php file. Paste the following line into wp-config.php and save the file.
Step 2: Enable Real Cron
Open the Cron Editor in WebCP and add a new Cron job to run every 5 minutes (use the drop-down to select the 5-minute interval).
Add a cron job with the following:
wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Press save in the cron editor. You should now see the cron job listed and real cron is running on your WordPress site.