set_permalink_structure(self::DEFAULT_STRUCTURE); return; } // No rewrite object (CLI/tests): persist the option so the next request boots sane. update_option('permalink_structure', self::DEFAULT_STRUCTURE); } /** * Theme activation: persist the theme's own rewrite rules immediately. */ public function flush_on_activate(): void { flush_rewrite_rules(); } /** * Self-heal after a theme version bump without the repeated flush the old * `init`-hook version stamp caused on every first request of a new version. */ public function flush_when_version_changes(): void { $flushed = (string) get_option('jio_rewrite_flushed_version', ''); if ($flushed === JIO_VERSION) { return; } flush_rewrite_rules(); update_option('jio_rewrite_flushed_version', JIO_VERSION); } }