Why my uploaded picture was loaded into /uploads/2015/02 not /uploads/2016/01?

by it_is_a_literature   Last Updated October 01, 2018 15:08 PM

Today is 2016-01-01 in my console.

date
Fri Jan  1 14:24:04 CST 2016

Now I write an article attached a photo which is taken today and publish it today. I found that the URL of the photo was displayed as:

<a href="http://hwy.local/wp/wp-content/uploads/2015/02/scan.png">
  <img src="http://hwy.local/wp/wp-content/uploads/2015/02/scan-169x300.png" alt="scan" width="169" height="300" class="alignnone size-medium wp-image-2098" />
</a>

Why not src="http://hwy.local/wp/wp-content/uploads/2016/01/scan-169x300.png"?

  1. The photo was taken today.
  2. I upload it today.
  3. The date on my OS is 2016-01-01.

Why is uploads/2015/02/scan-169x300.png in src not uploads/2016/01/scan-169x300.png in the src?

Tags : date upload-dir


Answers 4


What date was/is the post published? Media uploads are added to the folder when the post/page was published, not the upload date. Was the post originally published in Feb 2015?

https://core.trac.wordpress.org/ticket/10752

Ray Mitchell
Ray Mitchell
January 12, 2016 14:41 PM

If uploaded to some content entity like e.g. post, page or custom post type, WordPress does arrange the attachments uploads by creation date of that entity - and not according to the upload, creation date of the attachment. That might just be the case for you, because otherwise I can't think of a reasonable, related to default behavior, explanation for what you are describing. If that isn't the case, then you have to check for interferences by plug-ins or the theme.

Nicolai
Nicolai
January 12, 2016 14:41 PM

About the assigned folders for uploaded photos -

  1. If a photo is uploaded within a post/page, it will be in the folder corresponding to the date of the post/page e.g. if post date is June 2015, uploaded photos will be in /uploads/2015/06 folder.

  2. If a photo is uploaded directly in the media library (not within any post/page), it will be in the folder corresponding to upload date e.g. if we upload a photo to library on January 2016, it will be in /uploads/2016/01 folder.

  3. We can derive that the date of the photo being taken is not relevant. In the above two cases, it doesn't really matter which date the photo was actually taken.

Syed Priom
Syed Priom
January 12, 2016 19:32 PM

If a photo is uploaded directly in the media library (not within any post/page), it will be in the folder corresponding to upload date e.g. if we upload a photo to library on January 2016, it will be in /uploads/2016/01 folder.

My site is not working like that. Direct media upload goes to 2017/03 folder and today is 2018/09

Westzonesolution Corp
Westzonesolution Corp
October 01, 2018 14:29 PM

Related Questions





front end post and uploads for custom post type

Updated April 25, 2018 14:08 PM