7

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?

  • 1
    Have you disabled all plugins and tried it? Have you switched to the default theme and tried it? – Howdy_McGee Jan 12 '16 at 14:40
12
+25

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

4

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.

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.