WP_Theme_JSON_Schema::unset_setting_by_path()private staticWP 5.9.0

Removes a property from within the provided settings by its path.

Method of the class: WP_Theme_JSON_Schema{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WP_Theme_JSON_Schema::unset_setting_by_path( $settings, $path );
$settings(array) (required) (passed by reference — &)
Reference to the current settings array.
$path(array) (required)
Path to the property to be removed.

Changelog

Since 5.9.0 Introduced.

WP_Theme_JSON_Schema::unset_setting_by_path() code WP 6.8.1

private static function unset_setting_by_path( &$settings, $path ) {
	$tmp_settings = &$settings;
	$last_key     = array_pop( $path );
	foreach ( $path as $key ) {
		$tmp_settings = &$tmp_settings[ $key ];
	}

	unset( $tmp_settings[ $last_key ] );
}