5 * MINUTE_IN_SECONDS, 'display' => __( 'Every 5 minutes (404Zen batches)', '404zen-broken-link-fixer' ), ); } return $schedules; } /** * Schedules both recurring events. */ public static function schedule_events() { // The activation hook runs after plugins_loaded, so make sure the // custom interval is registered before scheduling against it. add_filter( 'cron_schedules', array( __CLASS__, 'add_schedules' ) ); // phpcs:ignore WordPress.WP.CronInterval.CronSchedulesInterval if ( ! wp_next_scheduled( self::BATCH_HOOK ) ) { wp_schedule_event( time() + MINUTE_IN_SECONDS, 'lgbf_five_minutes', self::BATCH_HOOK ); } if ( ! wp_next_scheduled( self::DIGEST_HOOK ) ) { wp_schedule_event( time() + DAY_IN_SECONDS, 'weekly', self::DIGEST_HOOK ); } } /** * Re-schedules events if they went missing. */ public static function ensure_scheduled() { self::schedule_events(); } /** * Removes all recurring events. */ public static function clear_events() { wp_clear_scheduled_hook( self::BATCH_HOOK ); wp_clear_scheduled_hook( self::DIGEST_HOOK ); } }