Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#41767 closed feature request (duplicate)

plugin uninstall improvement

Reported by: petersplugins's profile petersplugins Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: administration Cc:

Description

Cleaning up data on plugin uninstall can be done via register_uninstall_hook() or uninstall.php. But at this point it is not possible to communicate with the user. So it is not possible to ask if data created by the plugin should be deleted or kept for later.

Many developers solve this by adding an option to the settings page of their plugin. This is not really user-friendly. Enabling the user to choose whether data should be deleted or kept on uninstall would be much better.

To achieve this the simplest solution in my opinion would be to add a new line to the Plugin Header. Something like e.g.

Creates Data: No/Yes

If set to YES the "Delete" link on the Plugin Page should be replaced with two links - "Delete Plugin & Keep Data" and "Delete Plugin And Data" or similar. Only if the user clicks on "Delete Plugin And Data" the uninstall hook should fire resp. the uninstall.php should be executed. So there would be no need to change the code.

If set to NO it would be possible to somehow inform that the plugin does not create any extra data. So the user knows that there will be no garbage after uninstall.

If the line is missing inside the Plugin Header the plugin uninstall should work as before.

This solution would be a huge improvement with little effort, I think.

Change History (2)

#1 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @petersplugins, welcome to WordPress Trac!

Thanks for the ticket, we're already tracking this enhancement in #20578.

#2 @petersplugins
7 years ago

Sorry, did not find that ticket when searching... Following.

Note: See TracTickets for help on using tickets.