W3cubDocs

/WordPress

WP_Theme_JSON_Schema::unset_setting_by_path( array $settings, array $path )

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

Parameters

$settingsarrayrequired
Reference to the current settings array.
$patharrayrequired
Path to the property to be removed.

Source

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

Changelog

Version Description
5.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json_schema/unset_setting_by_path