Delete taxonomy data on plugin deletion #1419
Merged
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.
Contributes to #1362
This PR deletes all taxonomy data: term meta, terms, term taxonomies, and term relationships.
Note that this data is deleted directly from the database and this cannot be undone! I've aimed to make this code simple, with some key automated tests, so we don't inadvertently delete data that we shouldn't. We should make sure to test it carefully.
Note: this builds upon #1418 and so the first commit (which is shared) should be ignored. After #1418 is merged, this will be rebased.
Testing
First, you may want to back up your data, or copy it to a fresh WordPress installation.
Ensure that the tests pass.
Enable Job Listing Categories and Tags, and apply some Categories and Tags to your Job Listings.
Delete the WP Job Manager plugin.
Look at your Job Categories and Job Types, and taxonomies from other plugins. Ensure they have not been deleted.
Inspect the database. All items in the
termmeta
,terms
,term_relationships
andterm_taxonomy
tables that were related to the WP Job Manager taxonomies (Job Listing Categories and Types) should be removed.Please also test on a multisite installation. When the plugin is deleted from the Network Admin, the data should be deleted across all sites.