WP VIP: Replacing files in the media library while keeping the url with original upload date

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

  1. Go to Posts → Add New, and create a temporary post, but do not click “Publish”.
  2. Change the publish date of the post to match the year and month of the original file’s URL.
  3. Save the post as a draft.
  4. Delete the original file from the Media Library.
  5. 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.
  6. Go to Media → Library, find the newly uploaded file, and detach it from the temporary post.
  7. That’s it! The file will now be stored under the same {year}/{month} directory as the original file.
  8. 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.

Table of Contents