Summery Summery
Turn on maintenance mode before attempting to upgrade the current theme.
Syntax Syntax
Description Description
Hooked to the ‘upgrader_pre_install’ filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().
Parameters Parameters
- $return
-
(Required) Upgrade offer return.
- $theme
-
(Required) Theme arguments.
Return Return
Source Source
File: wp-admin/includes/class-theme-upgrader.php
// Check that the folder contains a valid theme.
$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation.
return $source;
}
// A proper archive should have a style.css file in the single subdirectory.
if ( ! file_exists( $working_directory . 'style.css' ) ) {
return new WP_Error(
'incompatible_archive_theme_no_style',
$this->strings['incompatible_archive'],
sprintf(
/* translators: %s: style.css */
__( 'The theme is missing the %s stylesheet.' ),
'<code>style.css</code>'
)
);
}
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |