Codex

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

User:Plugin API/Action Reference/activated plugin

This page redirects to an external site: https://developer.wordpress.org/reference/hooks/activated_plugin/

Description

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.

Example

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

Related