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 🙂

Um poupador de tempo real

Você não acha tedioso e complicado ter que primeiro apagar um arquivo, e então enviar outro com o mesmo nome, cada vez que você precisa atualizar uma imagem ou qualquer arquivo enviado para a biblioteca de mídia do WordPress?

Bem, não mais!

Now you’ll be able to replace any uploaded file from the media “edit” view, where it should be. Media replacement can be done in one of two ways:

É simples substituir um arquivo

  1. Apenas substituir o arquivo. Esta opção requer que você faça upload de um arquivo do mesmo tipo que você está substituindo. O nome do anexo original permanecerá o mesmo, não importa qual seja o nome do arquivo enviado.
  2. Substituir o arquivo, usar o novo nome e atualizar todos os links. Se você marcar essa opção, o nome e o tipo do arquivo que você está prestes a enviar irão substituir o arquivo atual. Todos os links apontando para o arquivo atual serão atualizados para apontar para o nome do novo arquivo.

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!

Exibe o horário de modificação do arquivo

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

Do you have suggestions? Feel free to contact ShortPixel here


Want to help us improve the plugin feel free to submit PRs via GitHub here.

Imagens de tela

  • O novo link na biblioteca de mídia.
  • O botão de substituição de mídia, como visto na exibição "Editar mídia".
  • As opções de upload.
  • Obtenha a ID do arquivo no URL de edição do arquivo


Instalação rápida e fácil:

  1. Envie a pasta enable-media-replace para o diretório de plugins
  2. Ative o plugin por meio do menu “Plugins” no WordPress
  3. Feito!


O que este plugin faz exatamente?

Este plugin facilita atualizar/substituir arquivos que foram enviados para a biblioteca de mídia do WordPress.

Como ele funciona?

Uma nova opção estará disponível no modo de exibição de Editar mídia, chamado “Substituir mídia”. Esse é o lugar onde você poderá enviar um novo arquivo para substituir o antigo.

Eu troquei um arquivo, mas ele não mudou!

Existem duas razões principais para isto acontecer.

Primeira: Certifique-se de que você não está visualizando uma versão em cache do arquivo, especialmente se você substituiu uma imagem. Pressione “Recarregar” no seu navegador para certificar-se.

Segunda: Se o arquivo realmente parece inalterado, certifique-se de que WordPress tem permissões de gravação para os arquivos em sua pasta de uploads. Se você alguma vez já moveu sua instalação WP (talvez quando você migrou para um novo servidor), as permissões de seus arquivos enviados geralmente são redefinidas, então o WordPress pode já não ter mais as permissões para alterar os arquivos. Se você não sabe como fazer isso, entre em contato com o seu servidor de hospedagem web.


21 de agosto de 2021
Fantastic plugin filling in a huge gap in core WordPress functionality. A couple of very useful additional options and the comparison of image sizes between new and old versions are also nice touches. Highly recommended.
3 de agosto de 2021
It worked great and delivered exactly on what it promised. I don't mind the few advertisements on the side. I wish the developers success!
11 de junho de 2021
Top Tool für schnelles ersetzen von vorhandenen Bildern 1A*****
Leia todas as 244 avaliações

Colaboradores e desenvolvedores

“Enable Media Replace” é um software com código aberto. As seguintes pessoas contribuíram para este plugin.


“Enable Media Replace” foi traduzido para 30 localizações. Agradecemos aos tradutores por suas contribuições.

Traduzir “Enable Media Replace” para o seu idioma.

Interessado no desenvolvimento?

Navegue pelo código, dê uma olhada no repositório SVN ou assine o registro de desenvolvimento via RSS.

Registro de alterações


Release date: October 11th, 2021
* New: Constant EMR_CAPABILITY can define extra user roles to allow and deny replacements;
* New: Replacing an usual image with an SVG file will just replace all thumbnails by the main file;
* New: Also replaces caption when set in Exif data (when replacing with updating all links);
* Tweak: Added Now and Original options to Custom Date for usability;
* Tweak: changes/updates to the banners from the EMR screen;
* Fix: EMR now respects edit_other_posts permissions using default permissions;
* Fix: EMR with ALLOW_UNFILTERED_UPLOADS enabled (and allowed role) will not limit non-allowed uploads;
* Fix: some missing and wrong text-domains are now corrected (thanks @alexclassroom);
* Fix: a missing dot in the plugin description was preventing the transaltions to properly work;
* Fix: the plugin can now be uninstalled/deleted on PHP 8.


Release date: October 29th 2020
* New: EMR now replaces across all meta tables;
* New: the plugin remembers last used settings;
* New: integration with the LiteSpeed cache plugin and webserver;
* Tweak: manual Logging will no longer work if user is not logged as administrator;
* Tweak: added post_id to enable-media-replace-upload-done action args, props to @Jan Stiegler;
* Fix: fully works now with Elementor;
* Fix: the issue for WP-Bakery and URL-Encoded links is now fixed;
* Fix: the plugin should now work with images added through Visual Composer;
* Fix: EMR now uses queries instead of WordPress functions, correctly handling slashes and JSON formats;
* Fix: -scaled images generated by WordPress are now removed when replacing an image;


Release date: August 17th 2020
* New – Also display files size in the replacement windows;
* Fix – Replacing image with pdf file would cause noticesi;
* Fix – Compensation for faulty WordPress installation that return empty error string on wp_upload_dir and falsely return relative paths and urls on WP core functions;
* Fix – When choosing ‘replace file and update names’ and then uploading a file with identical name as source, it would postfix the duplicate name. This is no longer the case;
* Fix – Wording clarification for the situation when the filename is changed, which will lead to broken links from external sites;
* Fix – Added hard paths to require_once satements in order to prevent WP-CLI errrors;
* Fix – If source image doesn’t exist or in error state, replacement would be prevented by Javascript issue.


Release date: June 18th 2020
* Fix – PHP Error when settings permissions failed.


Release date: June 9th 2020
* New – In edit media screen EMR notes user who replaced file if this was not uploader;
* New – Added Drag and Drop area for files;
* New – When replacing with new file name, now also possible to update upload path;
* Fix – Various minor CSS tweaks and fixes;
* Update of Underlying libraries


Release date: 27th April 2020
* Fixed – When trying to upload over-limit file would show too many error messages;
* Language – 2 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.


Release date: 10th March 2020
* Fix the crashing of certain frontend builders when the plugin is active.


Release date: 23rd February 2020
* Fix issue with JSON encoding which was interfering with Advanced Custom Fields and other plugins


Release date: 23rd February 2020
* Fix issue with JSON encoded strings
* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted

Release date: 19th February 2020
* Fix issue with search/replacing non-image attachments and query
* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted


Release date: 18th February 2020
* Fixes for WP 5.3+ -scaled images system. Will now replace those as well.
* Updating and replacing images and thumbnails should now work for serialized (and such) metadata.
– For Beaver Builder
* Add extra warning if mimetype is not allowed by WordPress for upload
* Put Javascript version in wp_register_script
* Hidden double ‘replace media’
* Replace Image label to Replace Media
* Removed constant S3_UPLOADS_AUTOENABLE
* Improved detection of SVG image sizes
* Fixed – Logger doesn’t call wp_upload_dir when not debugging
* Extra – Javascript tries to resume after external errors.
* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted


Release date: 13th November 2019
* call the hook enable-media-replace-upload-done on both modes
* fix JSON compatibility for hostings that don’t have JSON module activated
* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted


Release date: 5th September 2019
* fix JSON compatibility for hostings that don’t have JSON module activated


Release date: 25th July 2019
* fix Replace button on the MediaLibrary image details popup


Release date: 23rd July 2019
* compatibility fixes for WP version 4.8 and below
* cache killer


Release date: 19th July 2019
* Fix error “using $this when not in object context” on some PHP versions


Release date: 17th July 2019
* Check if medium size !> 400px, display that one, otherwise smallest.
* Fixed: Links not updated when using Advanced Custom Fields
* Fixed: Fails silently when file is too big for upload
* When source file does not exist, show placeholder instead of failed image load
* Fixed: Fatal error when replacing images
* Fixed: Not the right time zone on replace
* Fixed Beaver Builder incompatibility by not allowing replace with rename.
* Fixed: Cannot replace non default WordPress file types, even those allowed to upload [ Media Library Assistant compat ]
* Fixed: error when trying to remove a file that doesn’t exist – because the files are actually on another server


Release date: 18th June 2019
* Fix error class not found on WPEngine


  • When replacing an image and changing the name, Search / Replace is now also done on the meta_value of postmeta.
  • Replace PDF thumbnails too
  • Copy title from EXIF
  • RTL View incorporated into the CSS
  • ‘wp_handle_upload’ filter should be treated as such (and not as action)
  • Use wp_attached_file instead of the GUID
  • Fix: replace missing file
  • Fix: aphostrophe breaking the upload
  • Fix: broken “before” image
  • Fix: update properly the date
  • Fix: errors for non-image items in Media Library
  • Fix: empty admin menu item created
  • Refactored all the code


  • 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.


  • Correção de erro, erro de digitação fez os metadados mudarem (graças ao usuário do GitHub icecandy!)
  • Removidos os links e imagens do Shortpixel


  • Testado até o 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!
  • Testado com WP 4.8


  • Testado até o WP 4.7.2
  • New PT translations (thanks Pedro Mendonca! https://github.com/mansj/enable-media-replace/commit/b6e63b9a8a3ae46b3a6664bd5bbf19b2beaf9d3f)


  • Testado até o 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)
  • Testado até o 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()
  • Adicionada a tradução japonesa (Obrigado, chacomv!)


  • Arquivos de idioma foram limpos
  • Tradução para o Português adicionada (graças a pedro-mendonca!)
  • Testado até o WP 4.1
  • Adicionadas as traduções ausentes em Sueco


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


  • Atualizado para o 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


  • Correção de erro no shortcode exibindo a data de modificação de um arquivo
  • Atualizadas todas as consultas do banco de dados em preparação para o 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)
  • Suprimido possível erro no novo gancho adicionado em 2.9.2


  • Pequena correção de erro
  • Added hook for developers to enable purging possible CDN when updating files – thanks rubious for the suggestion!


  • Adicionada tradução para o português brasileiro, graças ao 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


  • Adicionada tradução em Português (PT), graças ao Bruno Miguel Bras Silva!
  • Novo link de edição na biblioteca de mídia
  • 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.
  • New translations for simplified Chinese (thanks Tunghsiao Liu) and Italian (grazie Marco Chiesi)
  • Adicionado o método de detecção da tela de envio para garantir compatibilidade com as versões anteriores à 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.
  • Nova tradução para dinamarquês – graças a Michael Bering Petersen!


  • Testado com o WordPress 3.2.1
  • Nova tradução para alemão – graças a Martin Lettner!
  • New translation to French – thanks to 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.
  • Adicionada tradução holandesa por Ben ter Stal.


  • Correção de erro, corrigido um erro de digitação em popup.php, graças a Bill Dennen e outros por identificar isto!


  • 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!


  • Adicionado suporte para administração com SSL


  • Pop-up substituído com navegação em linha ao substituir mídia
  • Instruções adicionadas no link de administrador em Mídia


  • Testado com o WordPress 3.0 beta 2


  • Removed short tags for better compatibility.


  • Added support for wp_config setting “FORCE_SSL_ADMIN”


  • Adicionada a tradução russa, graças a Fat Cower.


  • Correção de erro menor, agora funciona no IE8 também!


  • Primeira versão estável do plugin.