activate_(plugin) хук-событиеWP 2.0.0

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.

Использование

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.
По умолчанию: false

Список изменений

С версии 2.0.0 Введена.

Где вызывается хук

activate_plugin()
activate_(plugin)
wp-admin/includes/plugin.php 705
do_action( "activate_{$plugin}", $network_wide );
wp-admin/plugins.php 196
do_action( "activate_{$plugin}" );

Где используется хук в WordPress

wp-includes/default-filters.php 663
add_action( 'activate_header', '_wp_admin_bar_init' );