Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#43956 closed feature request (duplicate)

_embed parameter should accept options on what to embed

Reported by: k1sul1's profile k1sul1 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords: needs-patch
Focuses: Cc:

Description

When creating a JavaScript powered single page application, performance is critical, and that's where _embed comes in. Instead of making separate requests for author, featured media, replies & terms, we can simply add _embed=1 as a query parameter, and everything embeddable is embedded into the response. HTTP2 is a thing, but WordPress bootstrap tends to take a while.

The thing is, in our use case, we really do not want the replies to be embedded, as they're useless until the user actually reads the article. That's why we'd like to load them in a separate request when they're actually needed.

We load dozens of posts in the front page of our app, which equals a "lot" of unneeded replies being loaded, and embedding replies can't be free in terms of performance.

Could we specify what we want to embed, in the parameter?

Something like ?_embed=featured_media,terms,author. ?_embed=1 would still embed everything, so anything existing shouldn't break.

Change History (2)

#1 @TimothyBlynJacobs
7 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Welcome to trac! We are already tracking this issue in #39696.

#2 @netweb
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.