Uses
| Uses | Description |
|---|---|
| wp-includes/theme.php: get_stylesheet() | Retrieves name of the current stylesheet. |
| wp-includes/load.php: is_wp_error() | Check whether variable is a WordPress Error. |
Turn on maintenance mode before attempting to upgrade the current theme.
Hooked to the ‘upgrader_pre_install’ filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().
(bool|WP_Error) (Required) Upgrade offer return.
(array) (Required) Theme arguments.
File: wp-admin/includes/class-theme-upgrader.php
public function current_before( $return, $theme ) {
if ( is_wp_error( $return ) ) {
return $return;
}
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
// Only run if current theme
if ( get_stylesheet() !== $theme ) {
return $return;
}
// Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) {
$this->maintenance_mode( true );
}
return $return;
} | Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/theme_upgrader/current_before