Plugin_Upgrader::active_after() WordPress Method
The Plugin_Upgrader::active_after() method is invoked after a plugin has been successfully activated. This is useful for doing any cleanup or initialization that may be necessary after a plugin has been activated. For example, you could use this method to load the plugin's textdomain or add any default settings to the database.
Plugin_Upgrader::active_after( bool|WP_Error $response, array $plugin ) #
Turns off maintenance mode after upgrading an active plugin.
Description
Hooked to the ‘upgrader_post_install’ filter by Plugin_Upgrader::upgrade().
Parameters
- $response
(bool|WP_Error)(Required)The installation response after the installation has finished.
- $plugin
(array)(Required)Plugin package arguments.
Return
(bool|WP_Error) The original $response parameter or WP_Error.
Source
File: wp-admin/includes/class-plugin-upgrader.php
public function active_after( $response, $plugin ) {
if ( is_wp_error( $response ) ) {
return $response;
}
// Only disable maintenance mode when in cron (background update).
if ( ! wp_doing_cron() ) {
return $response;
}
$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
// Only run if plugin is active.
if ( ! is_plugin_active( $plugin ) ) {
return $response;
}
// Time to remove maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) {
$this->maintenance_mode( false );
}
return $response;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 5.4.0 | Introduced. |