Alert: 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.

WP_Theme_JSON_Schema::rename_settings() WordPress Method

This function renames an existing setting in the schema. The first parameter is the old setting name, and the second parameter is the new setting name.

WP_Theme_JSON_Schema::rename_settings( array $settings, array $paths_to_rename ) #

Processes a settings array, renaming or moving properties.


Parameters

$settings

(array)(Required)Reference to settings either defaults or an individual block's.

$paths_to_rename

(array)(Required)Paths to rename.


Top ↑

Source

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

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


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.