On this page
Theme_Upgrader::current_before( bool|WP_Error $response, array $theme ): bool|WP_Error
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
$responsebool|WP_Error Required-
The installation response before the installation has started.
$themearray Required-
Theme arguments.
Return
Source
File: wp-admin/includes/class-theme-upgrader.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| get_stylesheet() wp-includes/theme.php | Retrieves name of the current stylesheet. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/theme_upgrader/current_before