Title: activate_{$plugin}
Published: April 25, 2014
Last modified: February 24, 2026

---

# do_action( “activate_{$plugin}”, bool $network_wide )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#wp--skip-link--target)

Fires as a specific plugin is being activated.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#description)󠁿

This hook is the “activation” hook used internally by [register_activation_hook()](https://developer.wordpress.org/reference/functions/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](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#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](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#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()](https://developer.wordpress.org/reference/functions/register_activation_hook/)
instead of this function.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#source)󠁿

    ```php
    do_action( "activate_{$plugin}", $network_wide );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/plugin.php#L703)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/plugin.php#L703-L703)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#related)󠁿

| Used by | Description | 
| [activate_plugin()](https://developer.wordpress.org/reference/functions/activate_plugin/)`wp-admin/includes/plugin.php` |

Attempts activation of plugin in a “sandbox” and redirects on success.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/activate_plugin/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Factivate_plugin%2F)
before being able to contribute a note or feedback.