You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add lifecycle and data-version scaffold to main plugin file #6
The main plugin file has no activation or deactivation handling and no data-version tracking. uninstall.php already ships good commented examples; the main file does not mirror that pattern. Result: every scaffolded project invents its own lifecycle and upgrade approach, inconsistently.
Add to the main plugin file, as commented examples that ship inert:
register_activation_hook() and register_deactivation_hook() calls at top-level file scope, with a comment stating they must not be nested inside another hook.
A data-version constant and a documented upgrade routine stub that compares the stored version against the constant and runs migrations in order.
A note that flush_rewrite_rules() belongs only after CPT or rewrite registration, and only when something changed.
Mirror the comment style already used in uninstall.php, and register the plugin's own boot at include time rather than from inside a hook: an add_action() added for the hook currently executing, at the priority being processed, never fires and does so silently.
Acceptance criteria
Activation and deactivation hook examples present at top-level scope in the main file, commented out by default.
A data-version constant and an upgrade stub are documented, with the stored-version comparison shown.
Guidance on flush_rewrite_rules() placement is included.
Plugin activates and deactivates with no fatals, warnings or notices on a scaffolded install.
No behaviour change by default — nothing in the added code runs until a project uncomments it.
Existing uninstall.php example pattern remains consistent with the new examples.
Activity