[wp-trac] [WordPress Trac] #49116: Add Links to the REST version of a Resource in the header of the page

WordPress Trac noreply at wordpress.org
Sun Jun 7 04:59:33 UTC 2020


#49116: Add Links to the REST version of a Resource in the header of the page
-------------------------------------------------+-------------------------
 Reporter:  dshanske                             |       Owner:  dshanske
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.5
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests dev-    |     Focuses:  rest-api
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by TimothyBlynJacobs):

 @dshanske I would look at
 `WP_REST_Post_Search_Handler::detect_rest_item_route`. We essentially only
 support using the built-in class.

 I would be in support of introducing something like:
 `rest_get_route_for_post( WP_Post ): string`. Importantly only returning
 the route, it would still need to be passed to `rest_url` to retrieve the
 full url. That could have a filter on it to support custom controllers.
 Similar methods could also be introduced for terms.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49116#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list