[wp-trac] [WordPress Trac] #63766: REST API fails if subtype CPT doesnt exist in Search Endpoint
WordPress Trac
noreply at wordpress.org
Wed Jul 30 14:15:20 UTC 2025
#63766: REST API fails if subtype CPT doesnt exist in Search Endpoint
-------------------------+------------------------------
Reporter: SirLouen | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion | Focuses:
-------------------------+------------------------------
Comment (by SirLouen):
Replying to [comment:1 mindctrl]:
> This appears to be intentional. The `other-type` is not a valid enum
option if it's not a valid post type. See
`WP_REST_Post_Search_Handler::__construct()` where it calls
`get_post_types()` to define the subtypes.
>
> Reference: https://github.com/WordPress/wordpress-
develop/blob/965ee6152caa8a3e2bea2bf18e405220e45c53df/src/wp-includes
/rest-api/search/class-wp-rest-post-search-handler.php#L28-L39
Yes, this is why I tagged this as an enhancement and not a bug. Given that
this is a search, and the possibility that there could be a programmatic
search, not hindering the search with the fact that the CPT may not exist.
And I was also assuming the possibility of a use-case existence.
Personally, I would rather wait for the reporter to comment more on a use-
case, but I feel this unlikely. I would have closed the GB all around, but
just opened this issue as a reported upstream version and see for a couple
of months if the reporter is still interested in providing additional
information on what she was pretending to achieve.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63766#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list