Summery Summery

Turn on maintenance mode before attempting to upgrade the current theme.

Syntax Syntax

Theme_Upgrader::current_before( bool|WP_Error $return, array $theme )

Description Description

Hooked to the ‘upgrader_pre_install’ filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().

Parameters Parameters


(bool|WP_Error) (Required) Upgrade offer return.


(array) (Required) Theme arguments.

Return Return

(bool|WP_Error) The passed in $return param or WP_Error.

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(
					/* translators: %s: style.css */
					__( 'The theme is missing the %s stylesheet.' ),


Changelog Changelog

Version Description
2.8.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.