WP Cron not firing at plugin activation
-
I’ve been going around and around with this issue on several different hosts.
On Dreamhost,
register_activation_hook
works just fine and dandy. It executes the class for backing up the files in quest perfectly upon activation, executeswp_schedule_event
as expected and all-in-all does it’s thing.On my MediaTemple server, on the other hand, it’s not so accommodating.
register_activation_hook
seems to do absolutely nothing it’s told to do. If I force the issue when I install the plugin, it will schedule with wp-cron. If I don’t, then it sits there like a dead fish.At first, I assumed it was simply MT being…MT…but I’ve noticed this issue on other hosts as well. The company I work for maintains several different hosting accounts with several different providers, so we’ll just say this isn’t isolated to one provider.
Any ideas on the potential cause here? Here’s a brief version of the code – what works certain places, and what works everywhere.
Sometimes
register_activation_hook(__FILE__, 'registerBackup'); function registerBackup() { wp_schedule_event(time(), BACKUP_FREQUENCY, 'Backup'); executeBackup(); }
Always
wp_schedule_event(time(), BACKUP_FREQUENCY, 'Backup'); executeBackup();
Unfortunately, the always block requires time and effort it shouldn’t, and I need to streamline. Thoughts?
- The topic ‘WP Cron not firing at plugin activation’ is closed to new replies.