#61189 closed defect (bug) (fixed)
REST API: Attachments are not uploaded to the post's year/month folder
| Reported by: | swissspidy | Owned by: | swissspidy |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.6 |
| Component: | Media | Version: | 4.7 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | rest-api |
Description
If you upload an image to an existing post through the old media library modal, the image will be stored in the wp-content/uploads/<year>/<month> based on the post's publish date. For example, now is May, but if I upload it to a post from January, the image will be in wp-content/uploads/2024/01.
However, when uploading an image via the REST API (for example via drag & drop in the block editor), this is not the case, even though this comment on #40343 says otherwise.
So for consistency reasons, WP_REST_Attachments_Controller should be updated to match the media modal behavior (which can be found in media_handle_upload().
Props @patricia70 for helping me discover this.
Change History (5)
This ticket was mentioned in PR #6538 on WordPress/wordpress-develop by @swissspidy.
2 years ago
#1
@TimothyBlynJacobs commented on PR #6538:
2 years ago
#3
nice fix!
@swissspidy commented on PR #6538:
2 years ago
#5
Committed in https://core.trac.wordpress.org/changeset/58130
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/61189