diff --git a/docs/superpowers/plans/2026-04-17-cf7-spam-to-telegram.md b/docs/superpowers/plans/2026-04-17-cf7-spam-to-telegram.md index ca72e88..b57ad0a 100644 --- a/docs/superpowers/plans/2026-04-17-cf7-spam-to-telegram.md +++ b/docs/superpowers/plans/2026-04-17-cf7-spam-to-telegram.md @@ -2246,6 +2246,13 @@ final class Activator private static function schedule_events(): void { + // Register the custom 60-second schedule here — Dispatcher::register_hooks() + // runs on plugins_loaded, which is AFTER activation. Without this filter + // being in place during activate(), wp_schedule_event with an unknown + // recurrence ('cf7stg_every_minute') silently fails and the event never + // fires. + add_filter('cron_schedules', ['\\Cf7stg\\Dispatcher', 'register_schedule']); + if (!wp_next_scheduled('cf7stg_dispatch')) { wp_schedule_event(time() + 60, 'cf7stg_every_minute', 'cf7stg_dispatch'); } diff --git a/includes/class-activator.php b/includes/class-activator.php index 22b1037..a6d8911 100644 --- a/includes/class-activator.php +++ b/includes/class-activator.php @@ -66,6 +66,13 @@ final class Activator private static function schedule_events(): void { + // Register the custom 60-second schedule here — Dispatcher::register_hooks() + // runs on plugins_loaded, which is AFTER activation. Without this filter + // being in place during activate(), wp_schedule_event with an unknown + // recurrence ('cf7stg_every_minute') silently fails and the event never + // fires. + add_filter('cron_schedules', ['\\Cf7stg\\Dispatcher', 'register_schedule']); + if (!wp_next_scheduled('cf7stg_dispatch')) { wp_schedule_event(time() + 60, 'cf7stg_every_minute', 'cf7stg_dispatch'); }