_wp_array_get
- %1$s is private and should not be used in themes or plugins directly.
_wp_array_get ( $input_array, $path, $default_value = null )
Access:Parameters:- (array) input_array An array from which we want to retrieve some information.
- (array) path An array of keys describing the path with which to retrieve information.
- (mixed) default_value Optional. The return value if the path does not exist within the array, or if `$input_array` or `$path` are not arrays. Default null.
Returns:- (mixed) The value from the path specified.
Defined at: - Introduced in WordPress: 5.6.0
- Deprecated in WordPress: —
Description
Accesses an array in depth based on a path of keys.It is the PHP equivalent of JavaScript's `lodash.get()` and mirroring it may help other components
retain some symmetry between client and server implementations.
Example usage:
$input_array = array(
'a' => array(
'b' => array(
'c' => 1,
),
),
);
_wp_array_get( $input_array, array( 'a', 'b', 'c' ) );