Make WordPress Core

Changeset 57643

Timestamp:
02/16/2024 09:33:02 PM (5 months ago)
Author:
johnbillion
Message:

REST API: Clarify documentation for methods and filters relating to REST API search endpoints.

See #59651

Location:
trunk/src/wp-includes/rest-api/search
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php

    r49955 r57643  
    2727
    2828    /**
    29      * Searches the object type content for a given search request.
     29     * Searches the for a given search request.
    3030     *
    3131     * @since 5.6.0
    3232     *
    3333     * @param WP_REST_Request $request Full REST request.
    34      * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
    35      *               an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
    36      *               total count for the matching search results.
     34     * @return array {
     35     *     Associative array containing found IDs and total count for the matching search results.
     36     *
     37     *     @type string[] $ids   Array containing slugs for the matching post formats.
     38     *     @type int      $total Total count for the matching search results.
     39     * }
    3740     */
    3841    public function search_items( WP_REST_Request $request ) {
     
    4750
    4851        /**
    49          * Filters the query arguments for a REST API search request.
     52         * Filters the query arguments for a REST API search request.
    5053         *
    5154         * Enables adding extra arguments or setting defaults for a post format search request.
     
    8588
    8689    /**
    87      * Prepares the search result for a given ID.
     90     * Prepares the search result for a given .
    8891     *
    8992     * @since 5.6.0
     
    9194     * @param string $id     Item ID, the post format slug.
    9295     * @param array  $fields Fields to include for the item.
    93      * @return array Associative array containing all fields for the item.
     96     * @return array {
     97     *     Associative array containing fields for the post format based on the `$fields` parameter.
     98     *
     99     *     @type string $id    Optional. Post format slug.
     100     *     @type string $title Optional. Post format name.
     101     *     @type string $url   Optional. Post format permalink URL.
     102     *     @type string $type  Optional. String 'post-format'.
     103     *}
    94104     */
    95105    public function prepare_item( $id, array $fields ) {
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php

    r56547 r57643  
    4141
    4242    /**
    43      * Searches the object type content for a given search request.
     43     * Searches for a given search request.
    4444     *
    4545     * @since 5.0.0
    4646     *
    4747     * @param WP_REST_Request $request Full REST request.
    48      * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
    49      *               an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
    50      *               total count for the matching search results.
     48     * @return array {
     49     *     Associative array containing found IDs and total count for the matching search results.
     50     *
     51     *     @type int[] $ids   Array containing the matching post IDs.
     52     *     @type int   $total Total count for the matching search results.
     53     * }
    5154     */
    5255    public function search_items( WP_REST_Request $request ) {
     
    7982
    8083        /**
    81          * Filters the query arguments for a REST API search request.
     84         * Filters the query arguments for a REST API search request.
    8285         *
    8386         * Enables adding extra arguments or setting defaults for a post search request.
     
    103106
    104107    /**
    105      * Prepares the search result for a given ID.
    106      *
    107      * @since 5.0.0
    108      *
    109      * @param int   $id     Item ID.
    110      * @param array $fields Fields to include for the item.
    111      * @return array Associative array containing all fields for the item.
     108     * Prepares the search result for a given post ID.
     109     *
     110     * @since 5.0.0
     111     *
     112     * @param int   $id     Post ID.
     113     * @param array $fields Fields to include for the post.
     114     * @return array {
     115     *     Associative array containing fields for the post based on the `$fields` parameter.
     116     *
     117     *     @type int    $id    Optional. Post ID.
     118     *     @type string $title Optional. Post title.
     119     *     @type string $url   Optional. Post permalink URL.
     120     *     @type string $type  Optional. Post type.
     121     * }
    112122     */
    113123    public function prepare_item( $id, array $fields ) {
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php

    r54123 r57643  
    3737
    3838    /**
    39      * Searches the object type content for a given search request.
     39     * Searches t for a given search request.
    4040     *
    4141     * @since 5.6.0
     
    4545     *     Associative array containing found IDs and total count for the matching search results.
    4646     *
    47      *     @type int[]               $ids   Found IDs.
     47     *     @type int[]               $ids   Found IDs.
    4848     *     @type string|int|WP_Error $total Numeric string containing the number of terms in that
    4949     *                                      taxonomy, 0 if there are no results, or WP_Error if
     
    8080
    8181        /**
    82          * Filters the query arguments for a REST API search request.
     82         * Filters the query arguments for a REST API search request.
    8383         *
    8484         * Enables adding extra arguments or setting defaults for a term search request.
     
    111111
    112112    /**
    113      * Prepares the search result for a given ID.
     113     * Prepares the search result for a given ID.
    114114     *
    115115     * @since 5.6.0
    116116     *
    117      * @param int   $id     Item ID.
    118      * @param array $fields Fields to include for the item.
    119      * @return array Associative array containing all fields for the item.
     117     * @param int   $id     Term ID.
     118     * @param array $fields Fields to include for the term.
     119     * @return array {
     120     *     Associative array containing fields for the term based on the `$fields` parameter.
     121     *
     122     *     @type int    $id    Optional. Term ID.
     123     *     @type string $title Optional. Term name.
     124     *     @type string $url   Optional. Term permalink URL.
     125     *     @type string $type  Optional. Term taxonomy name.
     126     * }
    120127     */
    121128    public function prepare_item( $id, array $fields ) {
Note: See TracChangeset for help on using the changeset viewer.