Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/activated plugin

This page is marked as incomplete. You can help Codex by expanding it.


This hook is run immediately after any plugin is activated, and may be used to detect the activation of plugins.

If a plugin is silently activated (such as during an update), this hook does not fire.


function detect_plugin_activation(  $plugin, $network_activation ) {
    // do stuff
add_action( 'activated_plugin', 'detect_plugin_activation', 10, 2 );


  • Action: activated_plugin - runs when any plugin is activated
  • Action: deactivated_plugin - runs when any plugin is deactivated