diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php
index ae1e714ea8..1d6b8a7e68 100644
--- a/wp-includes/rest-api.php
+++ b/wp-includes/rest-api.php
@@ -104,17 +104,20 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
);
}
- if ( count( array_filter( $arg_group['args'], 'is_array' ) ) !== count( $arg_group['args'] ) ) {
- _doing_it_wrong(
- __FUNCTION__,
- sprintf(
- /* translators: 1: $args, 2: The REST API route being registered. */
- __( 'REST API %1$s should be an array of arrays. Non-array value detected for %2$s.' ),
- '$args
',
- '' . $clean_namespace . '/' . trim( $route, '/' ) . '
'
- ),
- '6.1.0'
- );
+ foreach ( $arg_group['args'] as $arg ) {
+ if ( ! is_array( $arg ) ) {
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: 1: $args, 2: The REST API route being registered. */
+ __( 'REST API %1$s should be an array of arrays. Non-array value detected for %2$s.' ),
+ '$args
',
+ '' . $clean_namespace . '/' . trim( $route, '/' ) . '
'
+ ),
+ '6.1.0'
+ );
+ break; // Leave the foreach loop once a non-array argument was found.
+ }
}
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1eb550cfef..00317eacc5 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.1-RC1-54517';
+$wp_version = '6.1-RC1-54518';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.