From 62d855bfe7f0751c722235e4f460a96eff46e722 Mon Sep 17 00:00:00 2001 From: TJCurnutte <211682330+TJCurnutte@users.noreply.github.com> Date: Tue, 12 May 2026 13:33:17 -0400 Subject: [PATCH] fix: flush bracket rewrite rules on activation --- bracketpress.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bracketpress.php b/bracketpress.php index a2cec0a..f99b6db 100644 --- a/bracketpress.php +++ b/bracketpress.php @@ -311,10 +311,17 @@ function activate() { $this->update_option('edit_id', wp_insert_post($post)); } + // The init hook does not run during plugin activation, so register the + // custom post type before flushing rewrites. Otherwise WordPress flushes + // rules without the bracket permalink structure and bracket links can 404 + // until the site owner manually saves permalinks. + $this->register_posts(); flush_rewrite_rules(); } - function deactivate() { } + function deactivate() { + flush_rewrite_rules(); + } function register_posts() {