2

Have been developing a site and noticed that all of the media files were being saved in the default WP year/month/day rule in the wp-content/uploads directory. I decided to change this to assets and unchecked the option to store these in the date format.

End goal here is to bring over all of the existing media to use that new path. I extracted all of the sub-folders into a flat list of files and then copied them over to the assets directory.

Then, I tried editing the GUID for attachments to the new location -- still, no dice. Right now, it's referencing those old files as assets/2012/08/01 instead of the new format.

I've verified the option for storing media files in the date subdirectories is unchecked -- is this stored in a transient/cache somewhere that I can reset? I'm more than comfortable going through and running the needed SQL queries to update any post content with these in them, but a bit confused on why the URLs on the front-end are not updating to just assets). Thanks!

Update

New files are being stored just in /assets and not the sub-date folders... really confused on these old file paths not working.

2 Answers 2

1

The relative path, including the date directories, is stored in the postmeta for the attachment's post, using the _wp_attached_file meta_key.

If you examine the data for that key, you'll find that the meta_value is 2012/08/example.jpg or something similar to that. This is used to build the URL.

0
-1

Go to your dashboard settings > media wp-admin/options-media.php under the file uploads heading place your new path in the associated field

1
  • Already done that as described in my question - the old file URLs are not updating on the front-end (even with a GUID update via the DB). Maybe they're stored in a transient somewhere based on the original file's creation date and then based on when that URL option is saved and new files are uploaded, take on that new URL path.
    – Zach
    Aug 17, 2012 at 14:40

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.