W3cubDocs

/WordPress

WP_Theme_JSON_Schema::migrate_v1_to_v2( array $old ): array

Removes the custom prefixes for a few properties that were part of v1:

Description

‘border.customRadius’ => ‘border.radius’, ‘spacing.customMargin’ => ‘spacing.margin’, ‘spacing.customPadding’ => ‘spacing.padding’, ‘typography.customLineHeight’ => ‘typography.lineHeight’,

Parameters

$oldarrayrequired
Data to migrate.

Return

array Data without the custom prefixes.

Source

private static function migrate_v1_to_v2( $old ) {
	// Copy everything.
	$new = $old;

	// Overwrite the things that changed.
	if ( isset( $old['settings'] ) ) {
		$new['settings'] = self::rename_paths( $old['settings'], self::V1_TO_V2_RENAMED_PATHS );
	}

	// Set the new version.
	$new['version'] = 2;

	return $new;
}

Changelog

Version Description
5.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2