diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 5d1f52e762..623a69aba0 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -4876,6 +4876,26 @@ function wp_array_slice_assoc( $input_array, $keys ) { return $slice; } +/** + * Sorts the keys of an array alphabetically. + * + * The array is passed by reference so it doesn't get returned + * which mimics the behavior of `ksort()`. + * + * @since 6.0.0 + * + * @param array $input_array The array to sort, passed by reference. + */ +function wp_recursive_ksort( &$input_array ) { + foreach ( $input_array as &$value ) { + if ( is_array( $value ) ) { + wp_recursive_ksort( $value ); + } + } + + ksort( $input_array ); +} + /** * Accesses an array in depth based on a path of keys. * @@ -8429,21 +8449,3 @@ function is_php_version_compatible( $required ) { function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) { return abs( (float) $expected - (float) $actual ) <= $precision; } - -/** - * Sorts the keys of an array alphabetically. - * The array is passed by reference so it doesn't get returned - * which mimics the behavior of ksort. - * - * @since 6.0.0 - * - * @param array $array The array to sort, passed by reference. - */ -function wp_recursive_ksort( &$array ) { - foreach ( $array as &$value ) { - if ( is_array( $value ) ) { - wp_recursive_ksort( $value ); - } - } - ksort( $array ); -}