Make WordPress Core


Ignore:
Timestamp:
10/02/2020 05:45:49 PM (6 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Allow for string ids in the search controller.

Previously, the search controller infrastructure required that the id property was an integer. This prevents data models that use a string id from utilizing the search infrastructure.

This commit lifts the restraint that search handlers return integer ids. This will allow for the Post Formats search handler coming in 5.6 to use slugs instead of creating fake ids.

Props stoyangeorgiev.
Fixes #51131.

File:
1 edited

Legend:

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

    r46586 r49088  
    8080         * @since 5.0.0
    8181         *
    82          * @param int  $id     Item ID.
    83          * @param array $fields Fields to include for the item.
     82         * @param int|string $id     Item ID.
     83         * @param array      $fields Fields to include for the item.
    8484         * @return array Associative array containing all fields for the item.
    8585         */
     
    9191         * @since 5.0.0
    9292         *
    93          * @param int $id Item ID.
     93         * @param int|string $id Item ID.
    9494         * @return array Links for the given item.
    9595         */
Note: See TracChangeset for help on using the changeset viewer.