WP_Customize_Setting::multidimensional_replace() WordPress Method

The WP_Customize_Setting::multidimensional_replace() method is used to recursively update a multidimensional array of Customizer settings. This is useful when replacing settings with updated values, or when resetting settings to their default values.

WP_Customize_Setting::multidimensional_replace( array $root, array $keys, mixed $value ) #

Will attempt to replace a specific value in a multidimensional array.


Parameters

$root

(array)(Required)

$keys

(array)(Required)

$value

(mixed)(Required)The value to update.


Top ↑

Return

(mixed)


Top ↑

Source

File: wp-includes/class-wp-customize-setting.php

	final protected function multidimensional_replace( $root, $keys, $value ) {
		if ( ! isset( $value ) ) {
			return $root;
		} elseif ( empty( $keys ) ) { // If there are no keys, we're replacing the root.
			return $value;
		}

		$result = $this->multidimensional( $root, $keys, true );

		if ( isset( $result ) ) {
			$result['node'][ $result['key'] ] = $value;
		}

		return $root;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.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.