Theme_Upgrader::current_after() WordPress Method

The Theme_Upgrader::current_after() method is used to upgrade the current theme to the latest version. This method is called after the theme is upgraded.

Theme_Upgrader::current_after( bool|WP_Error $response, array $theme ) #

Turn off maintenance mode after upgrading the active theme.


Description

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


Top ↑

Parameters

$response

(bool|WP_Error)(Required)The installation response after the installation has finished.

$theme

(array)(Required)Theme arguments.


Top ↑

Return

(bool|WP_Error) The original $response parameter or WP_Error.


Top ↑

Source

File: wp-admin/includes/class-theme-upgrader.php

	public function current_after( $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;
		}

		// Ensure stylesheet name hasn't changed after the upgrade:
		if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) {
			wp_clean_themes_cache();
			$stylesheet = $this->result['destination_name'];
			switch_theme( $stylesheet );
		}

		// Time to remove maintenance mode. Bulk edit handles this separately.
		if ( ! $this->bulk ) {
			$this->maintenance_mode( false );
		}
		return $response;
	}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.