Dprime Media Replace v1.2.0
Replace any image or SVG in the Media Library with a new file. Same attachment ID, every reference updates automatically.
Installation
- Download the plugin zip from my.dprime.au.
- Go to Plugins > Add New > Upload Plugin, choose the zip, and activate.
- Go to Dprime > Media Replace or use the Replace file actions that appear in the Media Library.
How to replace a file
There are four ways to get to the replace form:
| Entry point | How |
|---|---|
| Media Library list | Hover any item, click the Replace file row action |
| Media modal | Click any attached image in the post editor, then Replace file in the right sidebar |
| Edit Media screen | The Replace file meta box is in the sidebar of every attachment edit page |
| Plugin admin page | Look up a file by ID, URL, path, or filename then use the replace form |
Once on the replace form, drop a file onto the drop zone or click it to open the file picker. The zone shows a thumbnail, type, and file size after you choose. Click Replace file to submit.
Lookup modes
The plugin admin page lets you find a file four ways before replacing:
| Mode | Example value |
|---|---|
| Attachment ID | 1234 |
| URL | https://yoursite.com/wp-content/uploads/2025/03/hero.jpg |
| Server path | /var/www/html/wp-content/uploads/2025/03/hero.jpg |
| Filename | hero.jpg |
URL and Server path modes fall back to a filename match if the exact path is not in the database. This is useful when migrating between dev and production where absolute paths differ.
Keep original filename
The checkbox is ticked by default. With it on, the new file is written to the same path with the same name. Every URL in posts, pages, and templates keeps working unchanged.
Untick it to give the new file a different filename. The plugin keeps the old base name and appends the new extension. The URL changes, which forces browsers and CDNs to drop their cached copies immediately.
Allowed file types
- image/jpeg
- image/png
- image/gif
- image/webp
- image/avif
- image/svg+xml
You cannot replace an image with an SVG or an SVG with an image. The two format groups must match. For SVG uploads to work, install Dprime Safe SVG alongside this plugin.
FAQ
Will old posts and pages update automatically?
Yes. Because the attachment ID stays the same, every block, shortcode, template, or direct URL reference that uses that ID will serve the new file without any manual edits.
The image still shows the old version in the browser.
The URL is the same, so the browser may have the old file cached. Hard refresh (Ctrl+Shift+R or Cmd+Shift+R) to bypass the cache. End users pick up the new file as their cache expires. Untick Keep original filename if you need the cache busted immediately for everyone.
Can I replace a video or PDF?
No. The plugin only supports the six image MIME types listed above. Video and document replacement is outside its scope.
Who can use the replace function?
The plugin admin page requires the upload_files capability. Replacing a specific attachment also requires edit_post on that attachment. Subscribers and contributors cannot replace files they do not own.
Override classes
.dp-mr-page { /* outer page wrapper */ } .dp-mr-radio-group { /* match mode radio row */ } .dp-mr-result { /* found attachment card */ } .dp-mr-result-thumb { /* thumbnail in result card */ } .dp-mr-result-meta { /* metadata definition list */ } .dp-mr-dropzone { /* file drop zone */ } .dp-mr-dropzone-idle { /* drop zone idle state */ } .dp-mr-dropzone-chosen { /* drop zone after file chosen */ } .dp-mr-chosen-thumb { /* preview of chosen file */ } .dp-mr-chosen-name { /* chosen filename text */ } .dp-mr-chosen-remove { /* Remove button */ } .dp-mr-list { /* bulleted list in help tab */ }