By default, WordPress doesn’t allow you to replace uploaded files. This becomes especially challenging on WP VIP servers, where direct access to hosted files and folders isn’t available.
Here’s a practical workaround to replace a file while keeping the same URL and original upload date.
Before You Begin
- Try on a staging site first – If this is your first time doing this, test it on a non-production environment.
- Check upload permissions – In Network Admin → Settings, make sure the file type you want to upload (for example,
.csv) is included under Upload file types. - Back up the original file – Always create a backup before deleting or replacing anything.
- Save the original file URL – You’ll need the year and month from that URL later.
Steps to Replace the File
- Go to Posts → Add New, and create a temporary post, but do not click “Publish”.
- Change the publish date of the post to match the year and month of the original file’s URL.
- Save the post as a draft.
- Delete the original file from the Media Library.
- Upload the new file as the featured image of your temporary draft post.
- ✅ Make sure the filename is exactly the same as the original file.
- Go to Media → Library, find the newly uploaded file, and detach it from the temporary post.
- That’s it! The file will now be stored under the same
{year}/{month}directory as the original file. - You can safely delete the temporary draft post.
Optional: Plugin Alternative
If you prefer a plugin-based approach, you can try Enable Media Replace.
However, note that it may not work on WP VIP due to the platform’s unique file storage setup.