Chore/add Uninstall Handler#36
Open
jasperf wants to merge 5 commits into
Open
Conversation
Adds a "Danger Zone" section to the settings page with a checkbox (unchecked by default) that lets users choose to have all plugin data deleted when the plugin is uninstalled. Wired through defaults, validation, and the admin UI.
WordPress executes uninstall.php directly when the plugin is deleted via the admin. Removes warder_options and warder_options_last_updated only when the user has enabled the remove_data_on_uninstall setting.
Marks the uninstall cleanup as implemented (2.2.0), corrects the recommendation from Option A to Option B (uninstall.php), updates the API table, checklist, best practices list, and code example to match what was actually shipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This release (2.2.0) introduces opt-in uninstall cleanup functionality, allowing site administrators to automatically remove all plugin data from the WordPress database when the plugin is deleted. A new
remove_data_on_uninstallboolean setting was added to the options schema, and a dedicateduninstall.phphandler was introduced to execute the cleanup when WordPress triggers the uninstall hook. The implementation follows WordPress best practices by using theuninstall.phppattern rather than aregister_uninstall_hookcallback, ensuring cleanup runs reliably on deletion. Version bumps were applied consistently acrosswarder-cookie-consent.php,package.json,readme.txt, andCHANGELOG.mdper the project's versioning convention.Uninstall Cleanup Implementation:
uninstall.phpat the plugin root, which deletes thewarder_optionsandwarder_options_last_updateddatabase entries when the plugin is removed via the WordPress admin.remove_data_on_uninstallas an opt-in boolean setting (defaults tofalse), ensuring existing installations retain data unless the administrator explicitly enables cleanup before deletion.inc/defaults.phpandinc/settings.phpto register, sanitize, and persist the new setting alongside the existing options schema.Documentation and Developer Guidance:
docs/wordpress-options-api-usage.mddocumenting the Options API integration, including the newremove_data_on_uninstallfield, to support developers consuming plugin settings programmatically.readme.txtwith the 2.2.0 stable tag, changelog entry, and upgrade notice describing the new opt-in behavior.Project Configuration:
.vibe/config.tomlto addsupports_imagesand consolidate tool definitions, aligning the project's AI-assisted development configuration with current tooling.Files Changed:
.vibe/config.toml(Modified)CHANGELOG.md(Modified)inc/admin.php(Modified)inc/defaults.php(Modified)inc/settings.php(Modified)package.json(Modified)readme.txt(Modified)warder-cookie-consent.php(Modified)docs/wordpress-options-api-usage.md(Added)uninstall.php(Added)