We’ve recently come across a handful of reasons to ditch WordPress’ built in cron scheduler (wp-cron
). As with many things, I never remember exactly how it’s set up, so this is quick step by step I can refer back to. I’m not going to bother explaining what a cron is, or why you’d want to disable wp-cron. If you’ve come across this post from a search expect only the following bits here:
Disable WP Cron
To disable wp-cron
, log into your server and locate wp-config.php
. Then add the following line:
define('DISABLE_WP_CRON', true);
And that’s it.
Set up cron event in cPanel
Log into the cPanel account for the site you’re working on, then locate the Cron Jobs:
Set up cron event interval
Under the Add New Cron Job section you’ll find an interface for setting the event interval. From the Common Settings dropdown, choose Twice Per Hour:
If you’re opposed to using the dropdown, fill in the fields. Like an animal.
Add the event command
In the command field, add the following:
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
The >/dev/null 2>&1
portion disables email notifications.
Test that it’s working. Or not.
You could certainly run some tests here to make sure cron-based events continue to work in WordPress, but I think you’ll know pretty quickly if they aren’t running. If things you expect to update automatically stop doing so, double check your work.