Make WordPress Core

Opened 3 weeks ago

Last modified 4 days ago

#51722 new enhancement

Allow embedded links in preloaded api request

Reported by: spacedmonkey Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.0
Component: REST API Keywords: needs-patch needs-testing good-first-bug
Focuses: rest-api Cc:


Currently the rest_preload_api_request function doesn't embed links / respect the ?_embed= url param. This means that embedded links in the REST API can not be prefetched.

Change History (3)

#1 @TimothyBlynJacobs
3 weeks ago

  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to Future Release

This will require changing rest_preload_api_request to instead call $server->response_to_data() instead of just calling $response->get_data() directly. And pull _embed from $query_params and apply rest_parse_embed_param() to it.

#2 @technosailor
4 days ago

I'm looking to jump in on this ticket but I'm trying to grok how/where this method is used for testing reasons. But as an FYI... I am looking to pick this ticket up.

#3 @TimothyBlynJacobs
4 days ago

@technosailor great! In WordPress Core it is used to bootstrap the Block Editor. You can see that in action here: https://github.com/WordPress/wordpress-develop/blob/c869ef617e03677279ff64b68630da823275988e/src/wp-admin/edit-form-blocks.php#L79

Note: See TracTickets for help on using tickets.