Title: WP_Theme_JSON_Schema::migrate_v1_to_v2
Published: February 3, 2022
Last modified: August 20, 2026

---

# WP_Theme_JSON_Schema::migrate_v1_to_v2( array $old ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#changelog)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

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

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#description)󠁿

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#parameters)󠁿

 `$old`arrayrequired

Data to migrate.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#return)󠁿

 array Data without the custom prefixes.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme-json-schema.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-theme-json-schema.php#L79)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-theme-json-schema.php#L79-L92)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Theme_JSON_Schema::rename_paths()](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/rename_paths/)`wp-includes/class-wp-theme-json-schema.php` |

Processes the settings subtree.

  |

| Used by | Description | 
| [WP_Theme_JSON_Schema::migrate()](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate/)`wp-includes/class-wp-theme-json-schema.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json_schema/migrate_v1_to_v2/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme_json_schema%2Fmigrate_v1_to_v2%2F)
before being able to contribute a note or feedback.