WP_Theme_JSON_Schema::unset_setting_by_path()private staticWP 5.9.0

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

Метод класса: WP_Theme_JSON_Schema{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WP_Theme_JSON_Schema::unset_setting_by_path( $settings, $path );
$settings(массив) (обязательный) (передается по ссылке — &)
Reference to the current settings array.
$path(массив) (обязательный)
Path to the property to be removed.

Список изменений

С версии 5.9.0 Введена.

Код WP_Theme_JSON_Schema::unset_setting_by_path() WP 6.5.2

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