WordPress.org

Make WordPress Core

Opened 4 weeks ago

#51131 new enhancement

Remove constraint that search handlers must return integer ids

Reported by: TimothyBlynJacobs Owned by:
Milestone: 5.6 Priority: normal
Severity: normal Version: 5.0
Component: REST API Keywords: needs-patch needs-unit-tests good-first-bug
Focuses: Cc:

Description

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 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.

Change History (0)

Note: See TracTickets for help on using tickets.