Theme_Upgrader::current_before() WordPress Method
The Theme_Upgrader::current_before() method is used to perform any necessary actions before the current theme is upgraded. This method is called by the upgrade() method.
Theme_Upgrader::current_before( bool|WP_Error $response, array $theme ) #
Turn on maintenance mode before attempting to upgrade the active theme.
Description
Hooked to the ‘upgrader_pre_install’ filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().
Parameters
- $response
(bool|WP_Error)(Required)The installation response before the installation has started.
- $theme
(array)(Required)Theme arguments.
Return
(bool|WP_Error) The original $response parameter or WP_Error.
Source
File: wp-admin/includes/class-theme-upgrader.php
public function current_before( $response, $theme ) {
if ( is_wp_error( $response ) ) {
return $response;
}
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
// Only run if active theme.
if ( get_stylesheet() !== $theme ) {
return $response;
}
// Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) {
$this->maintenance_mode( true );
}
return $response;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |