I have a plugin which creates some options in wp_options, but also creates custom post types and is used to populate that post type. Upon install it makes sense to remove the data in wp_options, but with regards to the populated post type, there should be an option for the user to choose whether he wants to keep that data or not.
Ideally I would like a popup when he hits the uninstall link, asking if he wants to delete just the plugin files and options, or delete everything. How can I do such a popup?
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
How about something similar to this:
Which results in this:
Replace url1 with the url that would delete just the data.
Note that this will not run if you put it in the plugin and the plugin is deactivated, putting it in another plugin or in a theme would work but it would be bad practice
Also replace the ID of the embed github gist plugin with your own