WordPress.org

Ready to get started?Download WordPress

Forums

WP Cron not firing at plugin activation (1 post)

  1. Rebecca Schaefer
    Member
    Posted 2 years ago #

    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, executes wp_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?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by Rebecca Schaefer
  • This topic is not resolved
  • WordPress version: 3.2.1

Tags

No tags yet.