On this page
WP_Theme_JSON_Schema::rename_settings( array $settings, array $paths_to_rename )
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Processes a settings array, renaming or moving properties.
Parameters
$settingsarray Required-
Reference to settings either defaults or an individual block's.
$paths_to_renamearray Required-
Paths to rename.
Source
File: wp-includes/class-wp-theme-json-schema.php. View all references
private static function rename_settings( &$settings, $paths_to_rename ) {
foreach ( $paths_to_rename as $original => $renamed ) {
$original_path = explode( '.', $original );
$renamed_path = explode( '.', $renamed );
$current_value = _wp_array_get( $settings, $original_path, null );
if ( null !== $current_value ) {
_wp_array_set( $settings, $renamed_path, $current_value );
self::unset_setting_by_path( $settings, $original_path );
}
}
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Theme_JSON_Schema::unset_setting_by_path() wp-includes/class-wp-theme-json-schema.php | Removes a property from within the provided settings by its path. |
| _wp_array_set() wp-includes/functions.php | Sets an array in depth based on a path of keys. |
| _wp_array_get() wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
Used By
| Used By | Description |
|---|---|
| WP_Theme_JSON_Schema::rename_paths() wp-includes/class-wp-theme-json-schema.php | Processes the settings subtree. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json_schema/rename_settings