Is there some way to run a function when another plugin is being installed and/or activated?

Basically I need something like register_activation_hook only for other plugins.

The use case:

I want to check for CVE patches on my own server when a plugin is installed / activated.

The only thing I can think of right now is manually keeping track of activated and installed plugins, but this is not a very clean solution.

  • Why can't you use that function? It gets passed to is a plugin file name you can test against - Developer Resources
    – Howdy_McGee
    Apr 8, 2015 at 18:31
  • Because I don't know what plugins will be activated on the system. Hence I have no way of "binding" plugins by name.
    – PeeHaa
    Apr 8, 2015 at 18:32

1 Answer 1


I believe you are looking for activated_plugin and deactivated_plugin, see the wordpress documentation:

  • Wow. Not sure why I didn't find those. That is exactly what I am looking for.
    – PeeHaa
    Apr 8, 2015 at 18:31
  • Is there also a thing like that for installation of plugins by any chance?
    – PeeHaa
    Apr 8, 2015 at 18:34
  • 1
    I don't think so, but you can always get an up to date list of installed plugins via the get_plugins() function. If you're already keeping a running list of activated plugins you can get inactive plugins with something like $inactive_plugins = array_diff(get_plugins(),$active_plugins) Apr 8, 2015 at 19:03

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.