[wp-trac] [WordPress Trac] #51131: Remove constraint that search handlers must return integer ids

WordPress Trac noreply at wordpress.org
Tue Aug 25 01:25:47 UTC 2020


#51131: Remove constraint that search handlers must return integer ids
-------------------------+-------------------------------------------------
 Reporter:               |      Owner:  (none)
  TimothyBlynJacobs      |
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  5.6
Component:  REST API     |    Version:  5.0
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests good-
  Focuses:               |  first-bug
-------------------------+-------------------------------------------------
 The `WP_REST_Search_Controller` currently enforces that the `id` property
 returned by `WP_REST_Search_Handler::search_items` is an integer. AFAICT
 this constraint isn't required. But it does mean that items that don't
 have integer ids can't be searched.

 A string id isn't uncommon, for example uuids or hashids. But this also
 causes a particular issue in Gutenberg where we want to
 [https://github.com/WordPress/wordpress-
 develop/blob/c20372e0aa6d82fb4fdd65ed921d843b7fff6177/src/wp-includes
 /rest-api/endpoints/class-wp-rest-search-controller.php#L143 expose post
 formats] via the API. Ideally the formats would be referred to by their
 slug, but currently Gutenberg has to create fake ids to satisfy the search
 controller.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51131>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list