WP_Theme_JSON_Schema::migrate() WordPress Method

The WP_Theme_JSON_Schema::migrate() method is used to migrate a WordPress theme from one version to another. This is done by first creating a new theme directory, then copying the old theme directory into the new one.

WP_Theme_JSON_Schema::migrate( array $theme_json ) #

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


Parameters

$theme_json

(array)(Required)The structure to migrate.


Top ↑

Return

(array) The structure in the last version.


Top ↑

Source

File: wp-includes/class-wp-theme-json-schema.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.9.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.