W3cubDocs

/WordPress

do_action( "activate_{$plugin}", bool $network_wide )

Fires as a specific plugin is being activated.

Description

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.

Parameters

$network_wide

(bool) Whether to enable the plugin for all sites in the network or just the current site. Multisite only. Default false.

More Information

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

It is recommended to use the function register_activation_hook() instead of this function.

Source

File: wp-admin/includes/plugin.php

View on Trac

Changelog

Version Description
2.0.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/activate_plugin