Media sorted by year has changed its URL to include the current year directory
-
Hello everyone!
Please assist me with troubleshooting the issue I’ve never ran into before, and I’m kind of lost.
Wordpress 4.9.13 in a Multisite installation with Multisite Global Media plugin activated for the network (although deactivating it doesn’t resolve anything).
In wp-config uploaded media files are set to be sorted into directories by year:
$year = date( 'Y' ); define( 'UPLOADS', 'media/' . $year );
Last year I uploaded two images to be set as featured images. They got uploaded at media/2019 path on the server. So far so good, everything was okay and worked fine.
Today I discovered that featured image is not displayed. When I tried to open it individually on the site, I saw that instead of 2019 it had 2020 in the URL.
I connected to my website via FTP and saw that the images I uploaded last year were safely in their media/2019 directory.
In my website backend, in the Media Library I saw, that the images were now displayed as broken thumbnails. Clicking on an image to see the media file properties showed me incorrect URL, with 2020 in the URL instead of 2019.
I connected to the database and saw that correct URLs (with 2019 in path) were in the posts table.
What on earth might have happened, why did WordPress decide to rewrite existing files’ path? And how to fix it now?
Thanks for any input.
ETA: Looks like wp-config is responsible. It always provides the current year, but it looks like for old uploads their original path is not preserved. Media Library dynamically alters URLs for already existing images according to what wp-config supplies. Might be handy for moving sites. ?? However, I’m not sure what to do about my situation.
- The topic ‘Media sorted by year has changed its URL to include the current year directory’ is closed to new replies.