#35803 closed enhancement (fixed)
Introduce rest_get_request_from_url() for getting a WP_REST_Request object from a provided URL
Reported by: | danielbachhuber | Owned by: | rmccue |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | has-patch has-unit-tests dev-feedback |
Focuses: | Cc: |
Description
rest_get_request_from_url()
makes it easier to get a WP_REST_Request
object from a provided URL. Because _links
are the full URL, and not just the route, we should have a mechanism for resolving these URLs to WP_REST_Request
objects.
As a matter of fact, I'm pretty sure WP_REST_Server::embed_links()
doesn't work right now when pretty permalinks are disabled.
Attachments (4)
Change History (20)
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
9 years ago
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
9 years ago
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#7
@
9 years ago
Crossposting from slack:
@danielbachhuber: @joehoyle @rachelbaker @rmccue could I get feedback on https://core.trac.wordpress.org/ticket/35803 pretty please?
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
9 years ago
#9
@
9 years ago
Sorry for the delayed response! LGTM; not the nicest code, but not much you can do about that. I'm not sure on the naming though; what about WP_REST_Request::from_url()
?
@joehoyle @rmccue @rachelbaker Feedback on this when you have a moment. Couple of pieces I didn't get to in this first patch:
$url
is to a different domain, we should returnfalse
instead of creating aWP_REST_Request
object.WP_REST_Server::embed_links()
and make sure we have sufficient test coverage.