Theme_Upgrader::current_before

Advertisement

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

$return

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

$theme

(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(
				'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

Changelog
Version Description
2.8.0 Introduced.

Advertisement

Leave a Reply

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