activated_plugin
Action HookDescription
Fires after a plugin has been activated. If a plugin is silently activated (such as during an update), this hook does not fire.Hook Information
File Location |
wp-admin/includes/plugin.php
View on GitHub
|
Hook Type | Action |
Line Number | 730 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$plugin
|
Path to the plugin file relative to the plugins directory. |
bool
|
$network_wide
|
Whether to enable the plugin for all sites in the network or just the current site. Multisite only. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into activated_plugin
add_action('activated_plugin', 'my_custom_function', 10, 2);
function my_custom_function($plugin, $network_wide) {
// Your custom code here
}
Source Code Context
wp-admin/includes/plugin.php:730
- How this hook is used in WordPress core
<?php
725 *
726 * @param string $plugin Path to the plugin file relative to the plugins directory.
727 * @param bool $network_wide Whether to enable the plugin for all sites in the network
728 * or just the current site. Multisite only. Default false.
729 */
730 do_action( 'activated_plugin', $plugin, $network_wide );
731 }
732
733 if ( ob_get_length() > 0 ) {
734 $output = ob_get_clean();
735 return new WP_Error( 'unexpected_output', __( 'The plugin generated unexpected output.' ), $output );
PHP Documentation
<?php
/**
* Fires after a plugin has been activated.
*
* If a plugin is silently activated (such as during an update),
* this hook does not fire.
*
* @since 2.9.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param bool $network_wide Whether to enable the plugin for all sites in the network
* or just the current site. Multisite only. Default false.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-admin/includes/plugin.php
Related Hooks
Related hooks will be displayed here in future updates.