_wp_array_set ( $input_array, $path, $value = null )

  • private
  • (array) input_array An array that we want to mutate to include a specific value in a path.
  • (array) path An array of keys describing the path that we want to mutate.
  • (mixed) value The value that will be set.
Defined at:


Sets an array in depth based on a path of keys.It is the PHP equivalent of JavaScript's `lodash.set()` and mirroring it may help other components retain some symmetry between client and server implementations. Example usage: $input_array = array(); _wp_array_set( $input_array, array( 'a', 'b', 'c', 1 ) ); $input_array becomes: array( 'a' => array( 'b' => array( 'c' => 1, ), ), );

Related Functions

_wp_array_get, wp_array_slice_assoc, wp_parse_str, wp_cache_set, wp_kses_array_lc

Top Google Results

User discussions

wpseek mobile