'ids', 'number' => 0, ) ) as $site_id ) { switch_to_blog( (int) $site_id ); self::deactivate_site(); restore_current_blog(); } return; } self::deactivate_site(); } /** * Performs the deactivation tasks for the current site. */ private static function deactivate_site(): void { /** * Fires while the plugin is being deactivated on a single site. * * Scheduled events and transients are cleared here. * * @since 1.0.0 */ do_action( 'formpilot_deactivate' ); // Queued notifications stay in their option; only the runner is unscheduled. wp_clear_scheduled_hook( CronQueue::HOOK ); // Same for webhooks: the pending deliveries stay in the log, and the next // failure after reactivation schedules a run again. wp_clear_scheduled_hook( WebhookSender::HOOK ); wp_clear_scheduled_hook( OrphanCleaner::HOOK ); flush_rewrite_rules(); } }