Skip to content

Chore/add Uninstall Handler#36

Open
jasperf wants to merge 5 commits into
mainfrom
chore/add-uninstall-handler
Open

Chore/add Uninstall Handler#36
jasperf wants to merge 5 commits into
mainfrom
chore/add-uninstall-handler

Conversation

@jasperf

@jasperf jasperf commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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_uninstall boolean setting was added to the options schema, and a dedicated uninstall.php handler was introduced to execute the cleanup when WordPress triggers the uninstall hook. The implementation follows WordPress best practices by using the uninstall.php pattern rather than a register_uninstall_hook callback, ensuring cleanup runs reliably on deletion. Version bumps were applied consistently across warder-cookie-consent.php, package.json, readme.txt, and CHANGELOG.md per the project's versioning convention.

Uninstall Cleanup Implementation:

  • Added uninstall.php at the plugin root, which deletes the warder_options and warder_options_last_updated database entries when the plugin is removed via the WordPress admin.
  • Introduced remove_data_on_uninstall as an opt-in boolean setting (defaults to false), ensuring existing installations retain data unless the administrator explicitly enables cleanup before deletion.
  • Updated inc/defaults.php and inc/settings.php to register, sanitize, and persist the new setting alongside the existing options schema.

Documentation and Developer Guidance:

  • Added docs/wordpress-options-api-usage.md documenting the Options API integration, including the new remove_data_on_uninstall field, to support developers consuming plugin settings programmatically.
  • Updated readme.txt with the 2.2.0 stable tag, changelog entry, and upgrade notice describing the new opt-in behavior.

Project Configuration:

  • Updated .vibe/config.toml to add supports_images and consolidate tool definitions, aligning the project's AI-assisted development configuration with current tooling.

Files Changed:

jasperf added 5 commits June 5, 2026 12:29
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.
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.

1 participant