Theme_Upgrader::current_after()

最后更新于:2021-11-26 04:13:12

Theme_Upgrader::current_after( bool|GC_Error$return, array$theme)

Turn off maintenance mode after upgrading the current theme.

参数

$return

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

$theme

(array) (Required) Theme arguments.

响应

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

源文件

文件: gc-admin/includes/class-theme-upgrader.php

	public function current_after( $return, $theme ) {
		if ( is_gc_error( $return ) ) {
			return $return;
		}

		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';

		// Only run if current theme.
		if ( get_stylesheet() !== $theme ) {
			return $return;
		}

		// Ensure stylesheet name hasn't changed after the upgrade:
		if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) {
			gc_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 $return;
	}