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).

Refer:

deactivated_plugin

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *