WP_Theme_JSON_Schema::migrate()public staticWP 5.9.0

Function that migrates a given theme.json structure to the last version.

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

Хуков нет.

Возвращает

Массив. The structure in the last version.

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

$result = WP_Theme_JSON_Schema::migrate( $theme_json );
$theme_json(массив) (обязательный)
The structure to migrate.

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

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

Код WP_Theme_JSON_Schema::migrate() WP 6.5.2

public static function migrate( $theme_json ) {
	if ( ! isset( $theme_json['version'] ) ) {
		$theme_json = array(
			'version' => WP_Theme_JSON::LATEST_SCHEMA,
		);
	}

	if ( 1 === $theme_json['version'] ) {
		$theme_json = self::migrate_v1_to_v2( $theme_json );
	}

	return $theme_json;
}