I am looking for a way to track which user activates or deactivates a plugin for logging purposes. I've been searching around, but can only find information for plugin developers to have a hook to (de)activate their own plugin, but I want to be able to track which plugins are (de)activated from my theme or otherwise my own plugin.

Is there a generic hook for when a plugin gets (de)activated?

1 Answer 1


do_action( 'deactivate_' . $plugin, $network_deactivating );

Fires as a specific plugin is being deactivated.

do_action( 'deactivated_plugin', $plugin, $network_deactivating );

Fires after a plugin is deactivated.

The above hooks don't fire when silent mode is activated (eg: during an update).



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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