summaryrefslogtreecommitdiffstats
path: root/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wp-includes/rest-api/search/class-wp-rest-post-search-handler.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php b/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
index fb85fce..1d47723 100644
--- a/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
+++ b/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
@@ -40,14 +40,17 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler {
}
/**
- * Searches the object type content for a given search request.
+ * Searches posts for a given search request.
*
* @since 5.0.0
*
* @param WP_REST_Request $request Full REST request.
- * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
- * an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
- * total count for the matching search results.
+ * @return array {
+ * Associative array containing found IDs and total count for the matching search results.
+ *
+ * @type int[] $ids Array containing the matching post IDs.
+ * @type int $total Total count for the matching search results.
+ * }
*/
public function search_items( WP_REST_Request $request ) {
@@ -78,7 +81,7 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler {
}
/**
- * Filters the query arguments for a REST API search request.
+ * Filters the query arguments for a REST API post search request.
*
* Enables adding extra arguments or setting defaults for a post search request.
*
@@ -102,13 +105,20 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler {
}
/**
- * Prepares the search result for a given ID.
+ * Prepares the search result for a given post ID.
*
* @since 5.0.0
*
- * @param int $id Item ID.
- * @param array $fields Fields to include for the item.
- * @return array Associative array containing all fields for the item.
+ * @param int $id Post ID.
+ * @param array $fields Fields to include for the post.
+ * @return array {
+ * Associative array containing fields for the post based on the `$fields` parameter.
+ *
+ * @type int $id Optional. Post ID.
+ * @type string $title Optional. Post title.
+ * @type string $url Optional. Post permalink URL.
+ * @type string $type Optional. Post type.
+ * }
*/
public function prepare_item( $id, array $fields ) {
$post = get_post( $id );