[wp-trac] [WordPress Trac] #64034: Media / Attachments REST API endpoint: Include post (i.e. attached parent) as an embeddable link in the response

WordPress Trac noreply at wordpress.org
Wed Oct 8 23:52:01 UTC 2025


#64034: Media / Attachments REST API endpoint: Include post (i.e. attached parent)
as an embeddable link in the response
--------------------------------------+---------------------------
 Reporter:  andrewserong              |       Owner:  andrewserong
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  6.9
Component:  REST API                  |     Version:  trunk
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------------
Description changed by andrewserong:

Old description:

> In the Media / Attachments REST API endpoint, can we include the `post`
> (i.e. attached parent or "uploaded to") in the response, as a link under
> `_links`?
>
> The goal here is to make it easier to display or work with the "uploaded
> to" / "attached to" field of media via the REST API endpoint, as part of
> exploring a new media library.
>
> In my explorations so far, it will be a fair bit easier to work with if
> we can include a link in the API response to the `post` that the media
> item is associated with, as we'd then be able to query the endpoint with
> `_embed: 'post'` to list out the post title that media is linked to.
>
> For context, the new media library is being proposed in
> https://github.com/WordPress/gutenberg/issues/55238, where an Attached to
> / Uploaded to field will be required.

New description:

 In the Media / Attachments REST API endpoint, can we include the `post`
 (i.e. attached parent or "uploaded to") in the response, as a link under
 `_links`?

 The goal here is to make it easier to display or work with the "uploaded
 to" / "attached to" field of media via the REST API endpoint, as part of
 exploring a new media library.

 In my explorations so far, it will be a fair bit easier to work with if we
 can include a link in the API response to the `post` that the media item
 is associated with, as we'd then be able to query the endpoint with
 `_embed: 'post'` to list out the post title that media is linked to.

 For context, the new media library is being proposed in
 https://github.com/WordPress/gutenberg/issues/55238, where an Attached to
 / Uploaded to field will be required.

 Update: the final shape of this link relation is `https://api.w.org
 /attached-to`.

--

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


More information about the wp-trac mailing list