3

I need to do something anytime any plugin is uninstalled. There's a hook for when MY plugin is uninstalled but I don't see an uninstall equivalent of deactivated_plugin. Does uninstalling a plugin fire the deactivation action?

3

No, deactivated_plugin won't fire during a plugin's uninstallation process. But there are indeed two hooks that fire when a plugin is uninstalled:

  • pre_uninstall_plugin, which is called right before a plugin is uninstalled. It acts globally, targeting any plugin.
  • uninstall_{$file}, which fires after a specific plugin is uninstalled. Its scope it's limited to a unique plugin with basename {$file}. If you want to access the basenames of the whole plugins list, you can check the keys in the array that get_plugins() returns.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.