Plugin Uninstall - Make it optional to uninstall the plugin on delete if uninstall.php exists within the plugin folder
|Reported by:||sc0ttkclark||Owned by:|
There could be a function similar to
register_activation_hook( __FILE__, 'myplugin_activate' );
which could look like this
register_delete_hook( __FILE__, 'myplugin_delete' );
So that when you delete a plugin from the Plugin Admin interface, it will check the plugin's main file for that hook, if found it will run that function. The purpose of this would be to allow the plugin to cleanup data.
An optional prompt should be used on the delete screens to ask the user if they want to clear the plugin's "data" (only if the delete hook is found for the plugin). That would be most optimal.
Right now the only option is to go through that plugin, us the 'reset' function or something similar, deactivate, and then delete the plugin. It seems more logical to have a built-in wordpress hook that could call the plugin's delete function to remove the data.
Change History (16)
comment:4 sc0ttkclark — 5 years ago
- Summary changed from Plugin Delete - Allow hook similiar to register_activation_hook for when a Plugin is Deleted via Plugin Admin to Plugin Uninstall - Make it optional to uninstall the plugin on delete if uninstall.php exists within the plugin folder