diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php index 531c76fe1b2b3..3447d272a469e 100644 --- a/src/wp-includes/compat.php +++ b/src/wp-includes/compat.php @@ -418,6 +418,9 @@ function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConve foreach ( $array as $key => $value ) { return $key; } + + // Return null for an empty array. + return null; } } diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index c4db4871df644..8852519ec45c9 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1649,6 +1649,8 @@ protected function handle_terms( $post_id, $request ) { return $result; } } + + return null; } /**