#61189 closed defect (bug) (fixed)
REST API: Attachments are not uploaded to the post's year/month folder
Reported by: | swissspidy | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Media | Keywords: | has-patch has-unit-tests |
Focuses: | rest-api | Cc: |
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.
7 months ago
#1
@TimothyBlynJacobs commented on PR #6538:
7 months ago
#3
nice fix!
@swissspidy commented on PR #6538:
7 months ago
#5
Committed in https://core.trac.wordpress.org/changeset/58130
Trac ticket: https://core.trac.wordpress.org/ticket/61189