Replace Media Library Files
Guide to Updating Media Files with Enable Media Replace
The Enable Media Replace plugin solves a common frustration in WordPress: updating a PDF, image, or video without having to manually delete the old file, upload the new file, and then find and fix every link pointing to the old one.
This plugin ensures that the new file takes the exact place of the old one in your Media Library and keeps all your existing links intact.
Why Use Enable Media Replace?
When you normally upload a new file with the same name as an existing one, WordPress automatically adds a number (like filename-1.jpg ) to the new file, leaving the old one untouched and potentially breaking links on your site.
Enable Media Replace prevents this by:
- Preserving the URL: The new file keeps the exact same public link as the old file.
- Automatic Replacement: It instantly replaces the old file on your server.
- SEO Benefit: It avoids generating broken links (404 errors) or serving stale content to search engines and users.
Step-by-Step Instructions
1. Access the Replacement Tool
- Log into your WordPress Dashboard.
- Navigate to Media > Library.
- Find the existing file you wish to replace (e.g., an old version of a PDF or a previous logo image).
- Click on the file's title or the "Edit" link.
- In the right-hand panel (or the main editing area), look for the "Replace Media" box and click "Upload a new file."
2. Choose Your Replacement File
- Click "Choose File" and select the new file from your computer.
3. Select Replacement Options (Crucial Step)
After selecting the file, you must choose one of the two replacement methods under the "Replacement Options" section:
- Option A: Just Replace the File (Default)
Select: "Just replace the file" (This is the fastest method).
- Use when: Your new file is the exact same file type (e.g., JPEG replacing a JPEG) and you do NOT need to update the file's name or metadata (Title, Alt Text, Caption).
Note: If the new file has a different file extension (e.g., replacing a .PNG with a .JPG), choose Option B.
Option B: Replace the File, Use New File Name and Update Links
- Select: "Replace the file, use new file name and update all links"
- Use when: Your new file has a different name (e.g.,
report-v2.pdfreplacingreport-v1.pdf), or you have changed the file type (e.g., replacing a.GIFwith a.PNG). - Action: This option will update all links within your posts, pages, and custom post types to ensure they point to the new file's name and extension.
4. Update Metadata (Optional)
Under "Date Options," you have two choices:
- Option A: Keep the date of the old file (Recommended): This prevents search engines or users from thinking the content is brand new, keeping the original publishing date.
- Option B: Change the file date to the current date: Use this if the updated content is a significant revision that should be dated today.
5. Confirm Replacement
Click the blue "Upload" button. The plugin will immediately replace the old file with the new one on your server, preserving the original URL.
Final Step: Clear All Caches
Since browsers and website systems aggressively cache PDFs and images for speed, you must clear all caching layers after using Enable Media Replace to ensure everyone sees the updated file:
- Clear your WordPress Caching Plugin (e.g., WP Rocket, LiteSpeed, Breeze).
- Clear your Host's Server Cache (e.g., Cloudways Varnish/Redis).
- Clear your CDN Cache (e.g., Cloudflare Purge Everything).
Perform a Hard Refresh in your web browser (Ctrl + F5 or Cmd + Shift + R).