• Earlier, when I uploaded new images while editing an old post, these images used to be uploaded into a folder that corresponded to the post’s publishing date.

    For example, if the post I was adding a photo to was published in September 2010, the image would be uploaded into the folder /wp-content/uploads/2010/09/.

    (“Organize my uploads into month- and year-based folders” is activated in Settings > Media).

    From reading other posts in the forums, I understand that this is standard WordPress behaviour. I last did this 2-3 months ago and it worked as expected.

    Now, when I do the same today – editing an old post from 2010 and uploading a new image to this old post – the image is uploaded into the current date’s folder: /wp-content/uploads/2019-12/.

    I don’t think I changed anything in the meantime other than keeping WordPress and my plugins up to date.

    In case anyone has experienced the same, or if you have any ideas where to look, I’d be grateful. I would like all images to go into the folders corresponding with the original publishing date of each post.

    Thanks 🙂 🙏🏽

    • This topic was modified 6 years, 5 months ago by Jan Dembowski.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Earlier, when I uploaded new images while editing an old post, these images used to be uploaded into a folder that corresponded to the post’s publishing date.

    Are you sure it did? Because I think standard behavior is to upload to the current date folder.

    Thread Starter schikowski

    (@schikowski)

    @joyously are you aware of any documentation?

    Thread Starter schikowski

    (@schikowski)

    Here’s what I found so far:

    When media is uploaded to a post, the upload directory is set according to the date of the post, so that the media URLs in the post match when the post was published. – Link 1

    The issue I’ve found here is that if you go into a content type (e.g posts / custom post type) and select a featured image and upload a new image, it’s file name will use the year/month of the post type content and not todays date. e.g if you edit an old article from 2017/12, the media attached will have it’s path changed to use the 2017/12 directory. – Link 2

    I thought it was strange that it only happened on pages, while posts were still putting images in the post date folder. – Link 3

    When I uploaded an image to a post published several years ago, it went into the uploads folder corresponding to the month/year that the post was published. – Link 4

    Looking at all the above, while this seems to have changed for pages (see link 1), it seems that uploading an image when editing an older post, the image is indeed supposed to go into the corresponding old folder.

    I’m curious if others can confirm this.

    • This reply was modified 6 years, 5 months ago by schikowski. Reason: formatting

    Looks like you’re right that for anything other than pages WordPress will use the post date as you’ve seen in your first link.

    https://core.trac.ww.wp.xz.cn/browser/trunk/src/wp-admin/includes/media.php?rev=41964#L275

    We would expect the folder structure to be /uploads/2019/12/ instead of what you have in your initial question: /wp-content/uploads/2019-12/. WordPress wouldn’t use a dash notation for YYYY-MM in uploads. Could there maybe be a plugin or anything that sticks out which may be modifying your uploads to this kind of format? Is this a typo in your original question?

    Thread Starter schikowski

    (@schikowski)

    @howdy_mcgee that is indeed a typo in my original question.

    Thread Starter schikowski

    (@schikowski)

    Update: I found a workaround by uploading an image as a featured image. This will put it into the accurate, older folder.

    It doesn’t solve the mystery though.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Images uploaded into different folder’ is closed to new replies.