I have a WordPress Network that I am tasked with disabling the WP Cron and replacing it with an Apache Cron. I have set up a PHP script that when called by an Apache Cron will loop through all sites under the network and make a request to that site’s wp-cron.php page, thus executing its cron.
I would like to use WordPress’ transient feature to limit my PHP script as WordPress limits its own cron. However, when I dig into the code I see the doing_cron transient is set ( in cron.php #217 ) but never unset.
Is the transient ever unset or does WordPress wait 60 seconds to fire up the cron again ( in cron.php #200 )
Any thoughts on the doing_cron transient or perhaps another means to throttle my cron script would be appreciated.
2 s
Transients expire on their own. No need to unset them.
And to call wp-cron manually is simple. Just define DISABLE_WP_CRON to true in the wp-config file to disable the normal cron spawning process. Then make your cron system hit wp-cron.php manually every so often to process pending jobs.
There is no other special trick that you need to do. No need to fool around with transients or special coding.