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::unset_setting_by_path() WordPress Method

The WP_Theme_JSON_Schema::unset_setting_by_path() method can be used to unset a specific setting for a theme. This is useful if you want to remove a setting from a theme without having to delete the entire theme.

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

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


Parameters

$settings

(array)(Required)Reference to the current settings array.

$path

(array)(Required)Path to the property to be removed.


Top ↑

Return

(void)


Top ↑

Source

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

	private static function unset_setting_by_path( &$settings, $path ) {
		$tmp_settings = &$settings; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
		$last_key     = array_pop( $path );
		foreach ( $path as $key ) {
			$tmp_settings = &$tmp_settings[ $key ];
		}

		unset( $tmp_settings[ $last_key ] );
	}


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.