Skip to content

fix: flush bracket rewrite rules on activation#10

Open
TJCurnutte wants to merge 1 commit into
ntemple:masterfrom
TJCurnutte:fix/issue-7-flush-rewrite-rules
Open

fix: flush bracket rewrite rules on activation#10
TJCurnutte wants to merge 1 commit into
ntemple:masterfrom
TJCurnutte:fix/issue-7-flush-rewrite-rules

Conversation

@TJCurnutte
Copy link
Copy Markdown

Summary

  • Registers the brackets custom post type during plugin activation before flushing rewrite rules.
  • Flushes rewrite rules once on deactivation so stale bracket routes are removed.
  • Keeps rewrite flushing out of normal request handling.

Why

flush_rewrite_rules() was already called in activate(), but the plugin's normal bracketpress_init hook does not run during activation. That can flush rules before register_post_type( 'brackets', ... ) has populated the bracket permalink structure, leaving bracket links 404ing until a site owner manually saves permalinks.

Verification

  • git diff --check
  • Static activation-flow check confirmed $this->register_posts(); runs before flush_rewrite_rules();
  • Static deactivation-flow check confirmed deactivation flushes rewrites once

Note: php -l was not available in my local Mac environment.

Closes #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permalink structure needs to be flushed. Bounty $25

1 participant