Theme_Upgrader::current_before()publicWP 2.8.0

Turns on maintenance mode before attempting to upgrade the active theme.

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

Метод класса: Theme_Upgrader{}

Хуков нет.

Возвращает

true|false|WP_Error. The original $response parameter or WP_Error.

Использование

$Theme_Upgrader = new Theme_Upgrader();
$Theme_Upgrader->current_before( $response, $theme );
$response(true|false|WP_Error) (обязательный)
The installation response before the installation has started.
$theme(массив) (обязательный)
Theme arguments.

Список изменений

С версии 2.8.0 Введена.

Код Theme_Upgrader::current_before() WP 6.4.3

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

	// Change to maintenance mode. Bulk edit handles this separately.
	if ( ! $this->bulk ) {
		$this->maintenance_mode( true );
	}

	return $response;
}