Enable Media Replace


A free, lightweight and easy to use plugin that allows you to seamlessly replace an image or file in your Media Library by uploading a new file in its place. No more deleting, renaming and re-uploading files!
Supported by the friendly team that created ShortPixel 🙂

Un vero salvatempo

Non trovi noioso e complicato dover prima eliminare un file e poi caricarne uno con lo stesso nome ogni volta che desideri aggiornare un’immagine o un qualsiasi file caricato all’interno della libreria multimediale di WordPress?

Bene, non più!

Ora potrai sostituire qualsiasi file caricato dalla visualizzazione “modifica” media, come dovrebbe essere. La sostituzione dei supporti può essere eseguita in uno dei due modi:

È semplice sostituire un file

  1. Sostituisci solo il file. Questa opzione richiede di caricare un file dello stesso tipo di quello che si sta sostituendo. Il nome dell’allegato rimarrà lo stesso, non importa come si chiama il file che si carica.
  2. Sostituisce il file, utilizza il nuovo nome file e aggiorna tutti i collegamenti. Se si seleziona questa opzione, il nome e il tipo di file che si sta per caricare sostituirà il vecchio file. Tutti i collegamenti che puntano al file corrente verranno aggiornati per puntare al nuovo nome file.

This plugin is very powerful and a must-have for any larger sites built with WordPress. It now also comes with preview of the replaced image!

Mostra la data di modifica del file

There is a shortcode available which picks up the file modification date and displays it in a post or a page. The code is:
[file_modified id=XX format=XXXX] where the “id” is required and the “format” is optional and defaults to your current WordPress settings for date and time format.

So [file_modified id=870] would display the last time the file with ID 870 was updated on your site. To get the ID for a file, check the URL when editing a file in the media library (see screenshot #4)

If you want more control over the format used to display the time, you can use the format option, so [file_modified id=870 format=Y-m-d] would display the file modification date but not the time. The format string uses standard PHP date() formatting tags.

Compatible and recommended Plugins =

  • ShortPixel Image Optimization – Enable Media Replace is fully compatible with this plugin. Once enabled, ShortPixel will automatically optimize the images you replace using Enable Media Replace.
  • Resize Image After Upload plugin – automatically resize images upon upload to save traffic & disk space. Good for SEO and compatible with EMR.
  • Regenerate Thumbnails Advanced – Fast, free and simple to use plugin to regenerate the thumbnails for your site after changing a theme (for example). Supported & maintained by ShortPixel

Wishlist / Coming attractions

Hai dei suggerimenti? Contatta liberamente ShortPixel qui

Screenshot (schermate di esempio)

  • Il nuovo collegamento nella Libreria Media
  • Il bottone "Sostituisci media" come appare nella schermata "Modifica Media"
  • Le opzioni di caricamento.
  • Ottieni l'ID del file nell'URL modifica file


Installazione facile e veloce:

  1. Carica la cartella enable-media-replace nella tua directory dei plugin
  2. Attiva il plugin attraverso il menu ‘Plugin’ di WordPress
  3. Fatto!


Cosa fa attualmente questo plugin?

Questo plugin rende facile aggiornare/sostituire i file che sono stati caricati nella Libreria Media di WordPress.

Come funziona?

Una nuova opzione, chiamata “Sostituisci Media”, è disponibile nella visualizzazione Modifica Media. È qui che si può caricare un nuovo file per sostituire quello vecchio.

Ho sostituito un file, ma non è cambiato!

Ci sono due motivi principali per cui può succedere.

Per prima cosa, assicurati di non star visualizzando una versione del file memorizzata nella cache, soprattutto se è stata sostituita una immagine. Premere il tasto “Aggiorna” nel browser per assicurartene.

In secondo luogo, se il file sembra davvero invariato, assicurati che WordPress abbia i permessi per scrivere i file nella cartella di upload. Se hai spostato l’installazione del tuo WP (magari quando è stato spostato su un nuovo server), le autorizzazioni per i file caricati sono di solito reimpostate quindi WordPress non dispone più dei permessi per modificare i file. Se non sapete come cambiarli, contattate il vostro fornitore del web server.


Works great

Another plugin that provides such obvious functionality that it should be part of WP. I frequently need to update PDF files that folks can download, and this plugin makes it easy to preserver filenames.

Issues with plugin.

There are 2 notices and 1 warning when using this plugin. Once you click Upload if you are running in dev mode you get presented with 3 issues: Notice: Undefined index: file in /home/vagrant/HomesteadProjects/westerntech.test/western-tech/wp-content/plugins/enable-media-replace/thumbnail_updater.php on line 44 Notice: Undefined index: file in /home/vagrant/HomesteadProjects/westerntech.test/western-tech/wp-content/plugins/enable-media-replace/thumbnail_updater.php on line 45 Warning: Cannot modify header information - headers already sent by (output started at /home/vagrant/HomesteadProjects/westerntech.test/western-tech/wp-content/plugins/enable-media-replace/thumbnail_updater.php:45) in /home/vagrant/HomesteadProjects/westerntech.test/western-tech/wp-includes/pluggable.php on line 1223 These issues are horrible for a dev trying to build a WP site. Most people are probably installing this on a production site, hence why they don't see the errors but for anyone doing dev work this is super annoying. Please fix this.

Excellent Little Plugin

This is an excellent plug-in that is a must-have when working with WordPress. We run a large WooCommerce store and many times need to update product imagery. This little plug-in works great and is super easy to use. Thank you for creating it.

Confused my Imagify image optimization tool

The plugin does what it's supposed to do by either updating or replacing an image. Really liked the simple interface. The reason it's just a 4/5 for me is that I use 'Imagify' to optimize my images. When I replaced/updated an image then 'Imagify' didn't allow me to re-optimize it; as if it had got confused slightly. Therefore for me it was better to NOT use 'Enable Media Replace' and simply rename, upload, re-link to the new image instead. This then allows me to optimize and re-optimize the images as I am used to. Maybe use Shortpixel's image optimization instead to recvent this issue as they will probably work better with each other?
Leggi tutte le recensioni di 187

Crediti e riconoscimenti

“Enable Media Replace” è un software open source. Le persone che hanno contribuito allo sviluppo di questo plugin sono indicate di seguito.


“Enable Media Replace” è stato tradotto in 23 lingue. Grazie ai traduttori per i loro contributi.

Traduci “Enable Media Replace” nella tua lingua.

Ti interessa lo sviluppo?

Esplora il Codice segui il Repository SVN iscriviti al Log delle Modifiche. Puoi farlo tramite RSS con un lettore di feed.

Changelog (registro delle modifiche)


  • properly replace thumbnails names in the content when the replaced image has a different aspect ratio, thus the new thumbnails have a different height in the name.


  • fix for failures in link updating when replacing file because of addslashes – use prepared query instead
  • replace basename with wp_basename because basename doesn’t work well with UTF8


  • Add minimum required php version to run the plugin.
  • Security: Prevent direct access to php files.
  • Security: Prevent direct access to directories.
  • Security: Escape translation strings using esc_attr__() and esc_html__() functions.
  • Fix RTL issues.


  • no more 404 error if no image was selected when trying to replace it
  • added preview so you can check the image being replaced and also the image that’s being replaced with
  • .dat files can be replaced (functionality accidentally removed in the previous version)
  • added compatibility with S3 upload plugin
  • when an image is replaced the date is also updated


  • remove the leftover setcookie and the plugins recommendations.


  • Fix PDF thumbnails not replaced when replacing a PDF
  • Fix not replacing text files with .dat extension


  • disable ShortPixel recommendation on secondary sites of a multisite install when it was network activated.


  • Fixed compatibility with ShortPixel and Resize Image After Upload
  • Added ShortPixel links and images, fixed the problem of ShortPixel recommendation not dismissing.


  • Bugfix, typo made metadata changes (thanks GitHub user icecandy!)
  • Removed Shortpixel links and images


  • Tested with WP 4.9.4
  • Added Shortpixel link in replace media screen


  • Fixed bug introduced in an earlier version, preventing the updating of URLs on pages/posts if the link did not contain the domain name


  • Got rid of some pesky old code, and added some better filtering options, thanks to GitHub users speerface, aaemnnosttv, and ururk
  • Brand new, shiny code to replace other image sizes in embedded media, thanks to GitHub user ianmjones!
  • Testato con WP 4.8


  • Testato con WP 4.7.2
  • Nuova traduzione Portoghese (grazie a Pedro Mendonca! https://github.com/mansj/enable-media-replace/commit/b6e63b9a8a3ae46b3a6664bd5bbf19b2beaf9d3f)


  • Testato con WP 4.6.1


  • Fixed typo in .pt translations (https://github.com/mansj/enable-media-replace/pull/18)
  • Fixed better error handling in modification date functions (https://github.com/mansj/enable-media-replace/pull/16)
  • Testato con WP 4.4.1


  • Scrapped old method of detecting media screen, button to replace media will now show up in more places, yay!
  • Made sure the call to get_attached_file() no longer skips filters, in response to several users wishes.
  • Suppressed error messages on chmod()
  • Added Japanese translation (Thank you, chacomv!)


  • Ripuliti i file di lingua
  • Added Portuguese translation (Thanks pedro-mendonca!)
  • Testato con WP 4.1
  • Aggiunte stringhe mancanti nella traduzione in Svedese


  • Tiny fix to re-insert the EMR link in the media list view.


  • Aggiornato per WordPress 4.0
  • Now inheriting permissions of the replaced files, Thank you Fiwad



  • Added fix by Grant K Norwood to address a possible security problem in SQL statements. Thanks Grant!
  • Created GitHub repo for this plugin, please feel free to contribute at github.com/mansj/enable-media-replace


  • Bug fix for the short code displaying the modification date of a file
  • Updated all database queries in preparation for WP 3.9


  • Bug fix for timezone changes in WordPress
  • Minor UI change to inform the user about what actually happens when replacing an image and using a new file name


  • Added call to update_attached_file() which should purge changed files for various CDN and cache plugs. Thanks Dylan Barlett for the suggestion! (https://wordpress.org/support/topic/compatibility-with-w3-total-cache)
  • Suppressed possible error in new hook added in 2.9.2


  • Piccola correzione di errori
  • Added hook for developers to enable purging possible CDN when updating files – thanks rubious for the suggestion!


  • Added Brazilian Portuguese translation, thanks Roger Nobrega!
  • Added filter hook for file name creation, thanks to Jonas Lundman for the code!
  • Added modification date to the edit attachment screen, thanks to Jonas Lundman for the code!
  • Enhanced the deletion method for old file/image thumbnails to never give unnecessary error messages and more accurately delete orphaned thumbs


  • Aggiunta traduzione Portoghese, grazie a Bruno Miguel Bras Silva!
  • New edit link from media library
  • After uploading, the plugin now takes you back to edit screen instead of library


  • Made another change to the discovery of media context which will hopefully fix a bug in certain cases. Thanks to “Joolee” at the WordPress.org forums!
  • Added a new, supposedly better Russian translation from “Vlad”.


  • Fixed a small bug which could create error messages on some systems when deleting old image files.


  • New and safer method for deleting thumbnails when a new image file is uploaded.
  • Nuove traduzioni per il Cinese semplificato (grazie a Tunghsiao Liu) ed Italiano (grazie a Marco Chiesi)
  • Added method for detecting upload screen to ensure backward compatibility with versions pre 3.5


  • A couple of changes made to ensure compatibility with WordPress 3.5. Thanks to Elizabeth Powell for the fixes!


  • New and improved validation of uploaded files, now using WP’s own functions for checking file type and extension. Thanks again to my old friend Ulf “Ã…rsta” Härnhammar for keeping us all on our toes! 🙂 This should also hopefully fix the problems people have been having with their installations claiming that perfectly good PDF files are not allowed file types.


  • The “more reliable way” of determining MIME types turned out to be less reliable. Go figure. There seems to be no perfect way of performing a reliable check for MIME-types on an uploaded file that is also truly portable. I have now made checks for the availability of mime_content_type() before using it, using the old method as a fall-back. It is far from beautiful, so if anybody has a better way of doing it, please contact me!


  • Bug fix – there is now a more reliable way of determining file type on your upload so you can upload PDF files without seeing that pesky “File type does not meet security guidelines” message.
  • Nuova traduzione in Danese – grazie a Michael Bering Petersen!


  • Testato con WordPress 3.2.1
  • Nuova traduzione in Tedesco – grazie a Martin Lettner!
  • Nuova traduzione in Francese – grazie a François Collette!


  • Bug fix for WordPress 3.1 RC. Now properly tested and should be working with 3.1 whenever it finally comes out. 🙂


  • Bug fixes, security fixes. Thanks to my old pal Ulf “Årsta” Härnhammar for pointing them out!
  • New method for uploading avoids going around WP, for greater security.


  • Lots of code trimmed and enhanced, thanks to Ben ter Stal! Now working properly with Windows systems, better security, optimized loading, and much more.
  • Aggiunta traduzione Olandese da Ben ter Stal.


  • Bug fix, fixed typo in popup.php, thanks to Bill Dennen and others for pointing this out!


  • New shortcode – display file modification date on your site (see description for more info)
  • A couple of bug fixes for final release of 3.0 – Thanks to Jim Isaacs for pointing them out!


  • Added support for SSL admin


  • Replaced popup with inline navigation when replacing media
  • Added instructions in admin link under Media


  • Testato con WordPress 3.0 beta 2


  • Removed short tags for better compatibility.


  • Aggiunto il supporto per l’impostazione di wp_config “FORCE_SSL_ADMIN”


  • Aggiunta traduzione in Russo, grazie a Fat Cower.


  • Minor bugfix, now working with IE8 too!


  • Prima versione stabile del plugin.