wp/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php	Wed Sep 21 18:19:35 2022 +0200
@@ -82,7 +82,7 @@
 	}
 
 	/**
-	 * Registers the routes for the objects of the controller.
+	 * Registers the routes for the search controller.
 	 *
 	 * @since 5.0.0
 	 *
@@ -140,7 +140,7 @@
 			);
 		}
 
-		$ids = array_map( 'absint', $result[ WP_REST_Search_Handler::RESULT_IDS ] );
+		$ids = $result[ WP_REST_Search_Handler::RESULT_IDS ];
 
 		$results = array();
 
@@ -185,8 +185,9 @@
 	 * Prepares a single search result for response.
 	 *
 	 * @since 5.0.0
+	 * @since 5.6.0 The `$id` parameter can accept a string.
 	 *
-	 * @param int             $id      ID of the item to prepare.
+	 * @param int|string      $id      ID of the item to prepare.
 	 * @param WP_REST_Request $request Request object.
 	 * @return WP_REST_Response Response object.
 	 */
@@ -245,7 +246,7 @@
 			'properties' => array(
 				self::PROP_ID      => array(
 					'description' => __( 'Unique identifier for the object.' ),
-					'type'        => 'integer',
+					'type'        => array( 'integer', 'string' ),
 					'context'     => array( 'view', 'embed' ),
 					'readonly'    => true,
 				),