#35803 closed enhancement (fixed)
Introduce rest_get_request_from_url() for getting a WP_REST_Request object from a provided URL
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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.
10 years ago
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
10 years ago
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
10 years ago
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
10 years ago
#7
@
10 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.
10 years ago
#9
@
10 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:
$urlis to a different domain, we should returnfalseinstead of creating aWP_REST_Requestobject.WP_REST_Server::embed_links()and make sure we have sufficient test coverage.