Moving existing media items to new upload path structure not updating full URL path

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.

Read More

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.

Related posts

Leave a Reply

2 comments

  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.