WP_Theme_JSON_Schema::migrate_v1_to_v2
Removes the custom prefixes for a few properties that were part of v1:
'border.customRadius' => 'border.radius', 'spacing.customMargin' => 'spacing.margin', 'spacing.customPadding' => 'spacing.padding', 'typography.customLineHeight' => 'typography.lineHeight',
Method of the class: WP_Theme_JSON_Schema{}
No Hooks.
Returns
Array. Data without the custom prefixes.
Usage
$result = WP_Theme_JSON_Schema::migrate_v1_to_v2( $old );
- $old(array) (required)
- Data to migrate.
Changelog
| Since 5.9.0 | Introduced. |
WP_Theme_JSON_Schema::migrate_v1_to_v2() WP Theme JSON Schema::migrate v1 to v2 code WP 6.9.1
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;
}