-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature 681: Adding uninstall method #716
base: develop
Are you sure you want to change the base?
Feature 681: Adding uninstall method #716
Conversation
global $wpdb; | ||
|
||
// Delete Options. | ||
$option_name = 'wporg_option'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just an example. We need to remove things we store in the options table (GatherPress settings). In addition to deleting options, should delete user meta, taxonomies, events, venues, etc. Some things like post meta will be deleted automatically with the posts. We might want to delete things in options table by looking for anything that prepends with gatherpress_
. What do you think @carstingaxion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at https://github.com/stephenharris/Event-Organiser/blob/65c4e3b0f40a601bebf7d5fc2203da02bbb4d7e9/includes/event-organiser-install.php#L404 as a nice example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I especially liked about the linked implementation was:
- additional check if plugin is network-enabled
- deletion of user_meta
In addition:
For the multiple options I suggest an array function like array_walk
calling delete_option
on the list of all options and transients as well.
Preview changes with PlaygroundYou can preview the least recent changes for PR#716 by following one of the links below: |
Description of the Change
This PR adds an uninstall method to clear out any plugin options, settings specific to the plugin, and/or other database entities such as tables.
Where possible, please also include:
Closes #
How to test the Change
Changelog Entry
Credits
Props @bluecollarcoders
Checklist: