[wp-trac] [WordPress Trac] #48257: REST API: post-process endpoint cannot be discovered from media creation endpoint
WordPress Trac
noreply at wordpress.org
Sun May 17 19:51:07 UTC 2026
#48257: REST API: post-process endpoint cannot be discovered from media creation
endpoint
--------------------------+-----------------------------
Reporter: kadamwhite | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 5.3
Severity: normal | Resolution:
Keywords: has-patch | Focuses: rest-api
--------------------------+-----------------------------
Changes (by kunalpareek):
* keywords: needs-patch => has-patch
Comment:
I've reviewed this ticket along with #47987 and looked at the current
trunk code in **class-wp-rest-attachments-controller.php**.
The order-of-operations issue mentioned in the description is still
present. In **create_item()**, **X-WP-Upload-Attachment-ID** is sent via a
raw **header()** call before **$response** exists - **$response** is only
available after **wp_update_attachment_metadata()**, which is exactly the
step that can fatal.
However, the **Link** header does not need to be sent at the same moment
as **X-WP-Upload-Attachment-ID**. It can be added to **$response** after
it is constructed, alongside the existing **Location** header. On a
successful response this makes the post-process endpoint formally
discoverable. If the server fatals mid-processing, the client still has
**X-WP-Upload-Attachment-ID** as the fallback signal both mechanisms
complement each other.
I've attached a patch that adds **$response->add_link()** in
**create_item()** using the **https://api.w.org/action-post-process**
relation, following the **api.w.org/action-*** pattern used elsewhere in
core. I avoided **edit-media** as that relation is already used by the
**/edit** endpoint and would be semantically incorrect here.
Please let me know if the relation name needs adjustment or if the patch
needs changes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48257#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list