Photo by cottonbro from Pexels

Replacing Media File Uploads In WordPress

Have you ever wanted to replace an upload on your WordPress media library? By default, it can be done only by uploading a new file, replacing it in your content, and then deleting the old upload.

This technique is both long and causes clatter in your media library as well as dead links on the internet, The reason is that newly uploaded file gets a new permalink.

There is one different way to replace any image – On media library, click “edit” view, and you can replace your file in one of two ways:

Simple Replace

It just replaces your file. The option requires you to upload a new file of the same type as the one you are replacing. The name of the attachment remains the same no matter what filename you upload.

Replace the file and update all links

The option replaces the old file, uses the new file name, and updates all links i.e. all links pointing to the old file are updated to point to the new file.

How To Replace Media Files?

  1. Install and activate the Enable Media Replace plugin
  2. Next, visit Media -> Library in your WordPress admin area
  3. Locate the file that you want to replace
  4. Take your mouse near the file name
  5. Click the link labeled as ‘Replace Media’
  6. Click the ‘Choose File’ button
  7. Select from the two options:
    • Just replace the file
    • Replace the file, and update all links
  8. Press the ‘Upload’ button

The plugin also provides you a shortcode that picks up the file modification date to display it in your posts and pages.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.