Best WordPress Hosting
 

Miscellaneous REST API improvements in WordPress 6.1

via make.wordpress.org => original post link

Search REST resources by ID across subtypes

WordPress 6.1 includes an enhancement to the search controller, #56546, which makes it possible to retrieve a term or post object over the REST API without knowing anything but that resource’s ID and object type.

get_post can retrieve a post of any post type so long as you know the post’s numeric ID, and get_term can retrieve a term from any taxonomy. Because REST objects are segregated by post type-specific endpoints, however, there has not been a clear way to get a Post with ID 78 if you don’t know whether it is a page, post, or my-cpt.