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:
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?
- Install and activate the Enable Media Replace plugin
- Next, visit Media -> Library in your WordPress admin area
- Locate the file that you want to replace
- Take your mouse near the file name
- Click the link labeled as ‘Replace Media’
- Click the ‘Choose File’ button
- Select from the two options:
- Just replace the file
- Replace the file, and update all links
- 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.