Uploading media to old posts in WordPress backdates the file location

From the ashes of b2/cafelog

I first started using WordPress in 2003 not long after it had been forked from b2/cafelog. It was version 0.7, before they started using jazz-inspired code names for the releases.

  • There were no pages, only posts. Pages arrived in 2005, version 1.5 Strayhorn.
  • There was no plugin architecture: if you wanted to make changes to the functionality of the application then you had to edit the core files (and re-edit them every time you updated WordPress… which was all done manually, of course). Plugins arrived in 2004, version 1.2 Mingus.
  • There were no themes. Support for that also arrived in 2005, version 1.5 Strayhorn, and was greatly improved in 2010, version 3.0 Thelonious.

The media library was also very basic in those days. You actually had to add the absolute path of the media folder in your b2config.php file, like this: $fileupload_realpath = '/home/example/public_html/images';

Organize media into folders

The media library improved over the years but one thing I never got around to switching on was this one, now found in Settings > Media: “Organize my uploads into month- and year-based folders”. I kind of wish I had now, because I have nearly 3,680 images sitting loose in /wp-content.

As part of my site migration from www.garethjmsaunders.co.uk to www.garethjmsaunders.co.uk/blog I am trying to plan the best way to move all these images into month- and year-based folders. If you have any thoughts please do leave them in the comments.

What I did discover, however, is that if I were to retrospectively upload an image today to the media library, say for a blog post dated 9 August 2007, WordPress will upload it to a directory for the month associated with the post (/wp-content/uploads/2007/08/) and not the month I actually uploaded it (May 2014).

However, the media library filter still lists the file as having been uploaded during May 2014.

According to this support ticket “#10752 Uploading new media to existing posts/pages backdates file location” this is a feature, not a bug. It would be rather nice if you could choose which convention it uses: I’d prefer to be able to filter images according to when the image was used on a post, rather than when I ‘fixed’ the image.

Leave a Reply

Your email address will not be published. Required fields are marked *