WP_Customize_Setting::multidimensional_replace()protectedWP 3.4.0

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

Method of the class: WP_Customize_Setting{}

No Hooks.

Return

Mixed.

Usage

// protected - for code of main (parent) or child class
$result = $this->multidimensional_replace( $root, $keys, $value );
$root(array) (required)
-
$keys(array) (required)
-
$value(mixed) (required)
The value to update.

Changelog

Since 3.4.0 Introduced.

WP_Customize_Setting::multidimensional_replace() code WP 6.4.3

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