[wp-trac] [WordPress Trac] #34569: General purpose plugin uninstall hook
WordPress Trac
noreply at wordpress.org
Tue Nov 3 15:38:28 UTC 2015
#34569: General purpose plugin uninstall hook
----------------------------+-----------------------------
Reporter: eclev91 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 4.3.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
When you install or upgrade a plugin, there's a convenient hook
(`upgrader_process_complete`) that provides a pile of information about
what happened. You can subscribe to any install or upgrade and then use
the information you've been handed to decide if something needs to be
done.
No such thing for uninstall. Looks like the best you can get is in the
`uninstall_plugin()` function, line 990 of `wp-admin/includes/plugin.php`:
`do_action( 'uninstall_' . $file );`
Where `$file` is the plugin's main file name. This requires you to know
what plugin you're looking for if you hook on.
Use case:
I manage all my WP installs via Composer. When I install a plugin via the
admin, I can hook in and update my composer.json. It'd be nice to be able
to update on uninstall as well.
The current action could be left for backwards compatibility and a new one
written, or the old one could be dropped, as this new one would allow you
to determine what plugin was uninstalled and do something if necessary,
just like the old one.
I could work on a PR, but thought I'd get feedback on deprecation process
for the old one, if that's the route we want to go.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34569>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list