On this page
Plugin_Upgrader::active_after( bool|WP_Error $response, array $plugin ): bool|WP_Error
Turns off maintenance mode after upgrading an active plugin.
Description
Hooked to the ‘upgrader_post_install’ filter by Plugin_Upgrader::upgrade().
Parameters
$responsebool|WP_Error Required-
The installation response after the installation has finished.
$pluginarray Required-
Plugin package arguments.
Return
Source
File: wp-admin/includes/class-plugin-upgrader.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_doing_cron() wp-includes/load.php | Determines whether the current request is a WordPress cron request. |
| is_plugin_active() wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Changelog
| Version | Description |
|---|---|
| 5.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/plugin_upgrader/active_after