diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 36645f96c5..018ef57ec1 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -540,7 +540,26 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen include_once(WP_PLUGIN_DIR . '/' . $plugin); if ( ! $silent ) { + /** + * Fires before a plugin is activated in activate_plugin() when the $silent parameter is false + * + * @since 3.0.2 + * + * @param string $plugin Basename of the plugin path from {@see activate_plugin()} + * @param bool $network_wide Argument from {@see activate_plugin()} + */ do_action( 'activate_plugin', $plugin, $network_wide ); + + /** + * Fires before a plugin is activated in activate_plugin() when the $silent parameter is false + * + * The action concatenates the 'activate_' prefix with the $plugin value passed to + * activate_plugin() to create a dynamically named action. + * + * @since 3.0.2 + * + * @param bool $network_wide Argument from {@see activate_plugin()} + */ do_action( 'activate_' . $plugin, $network_wide ); } @@ -554,6 +573,14 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen } if ( ! $silent ) { + /** + * Fires after a plugin has been activated in activate_plugin() when the $silent parameter is false + * + * @since 3.0.2 + * + * @param string $plugin Basename of the plugin path from {@see activate_plugin()} + * @param bool $network_wide Argument from {@see activate_plugin()} + */ do_action( 'activated_plugin', $plugin, $network_wide ); } @@ -594,6 +621,16 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { $network_deactivating = false !== $network_wide && is_plugin_active_for_network( $plugin ); if ( ! $silent ) + /** + * Fires for each plugin being deactivated in deactivate_plugins(), before deactivation + * and when the $silent parameter is false. + * + * @since 3.3.2 + * + * @param string $plugin Basename of the plugin path from {@see activate_plugin()} + * @param bool $network_deactivating True if $network_wide passed in {@see deactivate_plugin()} + * is true and the plugin is active for the network. + */ do_action( 'deactivate_plugin', $plugin, $network_deactivating ); if ( false !== $network_wide ) { @@ -614,7 +651,30 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { } if ( ! $silent ) { + /** + * Fires for each plugin being deactivated in deactivate_plugins(), after deactivation + * and when the $silent parameter is false. + * + * The action concatenates the 'deactivate_' prefix with the plugin's basename + * to create a dynamically named action. + * + * @since 3.3.2 + * + * @param bool $network_deactivating True if $network_wide passed in {@see deactivate_plugin()} + * is true and the plugin is active for the network. + */ do_action( 'deactivate_' . $plugin, $network_deactivating ); + + /** + * Fires for each plugin being deactivated in deactivate_plugins(), after deactivation + * and when the $silent parameter is false. + * + * @since 3.3.2 + * + * @param string $plugin Basename of the plugin path from {@see activate_plugin()} + * @param bool $network_deactivating True if $network_wide passed in {@see deactivate_plugin()} + * is true and the plugin is active for the network. + */ do_action( 'deactivated_plugin', $plugin, $network_deactivating ); } } @@ -865,6 +925,15 @@ function uninstall_plugin($plugin) { include WP_PLUGIN_DIR . '/' . $file; add_action( 'uninstall_' . $file, $callable ); + + /** + * Fires in uninstall_plugin() once the plugin has been uninstalled. + * + * The action concatenates the 'uninstall_' prefix with the basename of the + * plugin passed to {@see uninstall_plugin()} to create a dynamically named action. + * + * @since 2.6.1 + */ do_action( 'uninstall_' . $file ); } }