deactivated_plugin
Action HookDescription
Fires after a plugin is deactivated. If a plugin is silently deactivated (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 | 840 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$plugin
|
Path to the plugin file relative to the plugins directory. |
bool
|
$network_deactivating
|
Whether the plugin is deactivated for all sites in the network or just the current site. Multisite only. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into deactivated_plugin
add_action('deactivated_plugin', 'my_custom_function', 10, 2);
function my_custom_function($plugin, $network_deactivating) {
// Your custom code here
}
Source Code Context
wp-admin/includes/plugin.php:840
- How this hook is used in WordPress core
<?php
835 *
836 * @param string $plugin Path to the plugin file relative to the plugins directory.
837 * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
838 * or just the current site. Multisite only. Default false.
839 */
840 do_action( 'deactivated_plugin', $plugin, $network_deactivating );
841 }
842 }
843
844 if ( $do_blog ) {
845 update_option( 'active_plugins', $current );
PHP Documentation
<?php
/**
* Fires after a plugin is deactivated.
*
* If a plugin is silently deactivated (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_deactivating Whether the plugin is deactivated 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.