WP_Theme_JSON_Schema::migrate( array $theme_json ): array

In this article

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

Parameters

$theme_jsonarrayrequired
The structure to migrate.

Return

array The structure in the last version.

Source

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;
}

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.