activate_(plugin)
Fires as a specific plugin is being activated.
This hook is the "activation" hook used internally by register_activation_hook(). The dynamic portion of the hook name, $plugin, refers to the plugin basename.
If a plugin is silently activated (such as during an update), this hook does not fire.
Usage
add_action( 'activate_(plugin)', 'wp_kama_activate_plugin_action' ); /** * Function for `activate_(plugin)` action-hook. * * @param bool $network_wide Whether to enable the plugin for all sites in the network or just the current site. Multisite only. * * @return void */ function wp_kama_activate_plugin_action( $network_wide ){ // action... }
- $network_wide(true|false)
- Whether to enable the plugin for all sites in the network or just the current site. Multisite only.
Default: false
Changelog
Since 2.0.0 | Introduced. |
Where the hook is called
wp-admin/includes/plugin.php 703
do_action( "activate_{$plugin}", $network_wide );
wp-admin/plugins.php 196
do_action( "activate_{$plugin}" );
Where the hook is used in WordPress
wp-includes/default-filters.php 664
add_action( 'activate_header', '_wp_admin_bar_init' );