diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 87efed9bf0..a1da4c162a 100644
|
|
function wp_parse_args( $args, $defaults = '' ) { |
4122 | 4122 | |
4123 | 4123 | |
4124 | 4124 | |
| 4125 | /** |
| 4126 | * Merge user defined arguments into defaults array, with recursive support. |
| 4127 | * |
| 4128 | * This function is used throughout WordPress to allow for both string or array |
| 4129 | * to be merged into another array. |
| 4130 | * |
| 4131 | * @since 5.2.2 |
| 4132 | * |
| 4133 | * @param string|array|object $args Value to merge with $defaults. |
| 4134 | * @param array $defaults Optional. Array that serves as the defaults. Default empty. |
| 4135 | * @return array Merged user defined values with defaults. |
| 4136 | */ |
| 4137 | |
| 4138 | function wp_parse_args_deep( &$a, $b ) { |
| 4139 | $a = (array) $a; |
| 4140 | $b = (array) $b; |
| 4141 | $result = $b; |
| 4142 | foreach ( $a as $k => &$v ) { |
| 4143 | if ( is_array( $v ) && isset( $result[ $k ] ) ) { |
| 4144 | $result[ $k ] = wp_parse_args_deep( $v, $result[ $k ] ); |
| 4145 | } else { |
| 4146 | $result[ $k ] = $v; |
| 4147 | } |
| 4148 | } |
| 4149 | return $result; |
| 4150 | } |
| 4151 | |
| 4152 | |
| 4153 | |
4125 | 4154 | /** |
4126 | 4155 | * Cleans up an array, comma- or space-separated list of scalar values. |
4127 | 4156 | * |