Title: Kodlo Media Replace
Author: Kodlo
Published: <strong>11 de Outubro de 2026</strong>
Last modified: 11 de Outubro de 2026

---

Buscar plugins

![](https://ps.w.org/kodlo-media-replace/assets/banner-772x250.png?rev=3740125)

![](https://ps.w.org/kodlo-media-replace/assets/icon-256x256.png?rev=3740125)

# Kodlo Media Replace

 Por [Kodlo](https://profiles.wordpress.org/kodlo/)

[Descargar](https://downloads.wordpress.org/plugin/kodlo-media-replace.1.0.0.zip)

 * [Detalles](https://gl.wordpress.org/plugins/kodlo-media-replace/#description)
 * [Valoracións](https://gl.wordpress.org/plugins/kodlo-media-replace/#reviews)
 *  [Instalación](https://gl.wordpress.org/plugins/kodlo-media-replace/#installation)
 * [Desenvolvemento](https://gl.wordpress.org/plugins/kodlo-media-replace/#developers)

 [Soporte](https://wordpress.org/support/plugin/kodlo-media-replace/)

## Descrición

Need to swap a product photo, an updated PDF price list or a corrected logo without
breaking a single link? Kodlo Media Replace overwrites the file of an existing attachment
and keeps everything else exactly as it was:

 * the attachment ID,
 * the file name,
 * the URL, including every thumbnail URL.

Pages, products, galleries and page builders that use the file show the new version
right away. There is nothing to search and replace.

#### How it works

Open a file in the Media Library, click **Replace file**, choose the new file and
confirm. That’s it.

#### What happens behind the scenes

 * **All image sizes are rebuilt** with the same function WordPress runs for a new
   upload.
 * **Old thumbnail URLs keep working.** When the new image has different proportions,
   thumbnail file names would normally change. The plugin recreates the old ones
   from the new image at their old dimensions, so URLs hard-coded in posts or page
   builders never return a 404 error.
 * **Large and rotated photos keep their URL** (the “-scaled” and “-rotated” files
   WordPress creates).
 * **WebP and AVIF copies** made by optimization plugins (photo.jpg.webp, photo.
   webp) are regenerated, so rewrite rules don’t keep serving the old picture.
 * **Browser and CDN caches:** on the front end, every URL of a replaced file gets
   a version parameter (?kmr=…), so visitors download the new file immediately, 
   even if the old one was cached for a year.
 * **Page caches are cleared** automatically when one of these is active: WP Rocket,
   W3 Total Cache, LiteSpeed Cache, WP Super Cache, WP Fastest Cache, SiteGround
   Optimizer, WP-Optimize, Breeze, Hummingbird, Cache Enabler, Nginx Helper, WP 
   Engine, Kinsta, Pantheon.
 * **Cloudflare (optional):** the replaced file URLs can be purged from the Cloudflare
   edge. See the FAQ.

#### Simple by design

No settings page, no ads, no tracking. Works with images, PDF files, video, audio
and documents.

The new file must have the same type as the old one (JPG for JPG, PDF for PDF), 
otherwise the URL would have to change.

### External services

This plugin can connect to the Cloudflare API to remove replaced files from the 
Cloudflare cache. It is off by default and only works after you add a Cloudflare
zone ID and API token to wp-config.php (see the FAQ).

When it is enabled, each time you replace a file the plugin sends a request to api.
cloudflare.com with your zone ID, your API token and the URLs of the replaced file
and its thumbnails (or a “purge everything” request if you enabled that option).
No other data is sent.

This service is provided by Cloudflare, Inc.: [Terms of Service](https://www.cloudflare.com/terms/),
[Privacy Policy](https://www.cloudflare.com/privacypolicy/).

## Capturas

[⌊The "Replace file" box on the edit screen of a media file.⌉⌊The "Replace file"
box on the edit screen of a media file.⌉[

The “Replace file” box on the edit screen of a media file.

[⌊After the replacement: same URL, new image. Old thumbnail URLs keep working even
when the proportions change.⌉⌊After the replacement: same URL, new image. Old thumbnail
URLs keep working even when the proportions change.⌉[

After the replacement: same URL, new image. Old thumbnail URLs keep working even
when the proportions change.

[⌊The "Replace file" link in the Media Library list view.⌉⌊The "Replace file" link
in the Media Library list view.⌉[

The “Replace file” link in the Media Library list view.

[⌊The "Replace file" button in the media details window (grid view).⌉⌊The "Replace
file" button in the media details window (grid view).⌉[

The “Replace file” button in the media details window (grid view).

## Instalación

 1. Install the plugin from Plugins > Add New, or upload the ZIP file.
 2. Activate it.
 3. Go to Media > Library, open a file and use the “Replace file” box.

## Preguntas frecuentes

### Where is the Replace button?

In the Media Library list view, hover over a file and click “Replace file”. In the
grid view, open a file and click “Replace file”. Both lead to the edit screen of
the file, where the “Replace file” box is in the right column.

### Will the URL or ID change?

No. The file is overwritten in place. The ID, file name, URL, title, alt text, caption
and description stay as they are.

### Can I replace a JPG with a PNG?

No. Changing the type would change the file extension and therefore the URL, which
is exactly what this plugin avoids. Convert the new file to the same type first.

### I still see the old image. What should I check?

Reload the page once without the browser cache (Ctrl+F5 or Cmd+Shift+R). Pages rendered
by WordPress get the new version parameter automatically. Files opened by a direct
link (for example a PDF link sent by email), or images referenced in external CSS
files, can still be served from a CDN until its cache expires. For Cloudflare, set
up the automatic purge described below.

### How do I enable the Cloudflare purge?

Create an API token in Cloudflare (My Profile > API Tokens > Create Custom Token)
with the permission Zone > Cache Purge > Purge for your domain. Then add this to
wp-config.php:

    ```
    define( 'KODLO_MR_CF_ZONE_ID', 'your-zone-id' );
    define( 'KODLO_MR_CF_API_TOKEN', 'your-api-token' );
    ```

If Cloudflare also caches your HTML pages (APO or a “Cache Everything” rule), add:

    ```
    define( 'KODLO_MR_CF_PURGE_EVERYTHING', true );
    ```

### Does it work with offloaded media (Amazon S3 and similar)?

No. The plugin replaces files in the local uploads folder. Media offloaded to external
storage is not supported.

### Does it work on multisite?

Yes, on each site of the network.

### Can I use it from code or WP-CLI?

Yes:

    ```
    Kodlo_Media_Replace::replace( $attachment_id, '/path/to/new-file.jpg' );
    ```

The new file is moved into place. The function returns an array on success or a 
WP_Error object.

### Which hooks are available?

 * `kodlo_mr_replaced` (action): fires after a replacement with the attachment ID
   and the list of file URLs. Use it to purge other caches.
 * `kodlo_mr_purge_page_cache` (filter): return false to skip clearing page caches.
 * `kodlo_mr_rewrite_html` (filter): return false to stop adding version parameters
   to the front-end HTML.

## Comentarios

Non hai recensións para este plugin.

## Colaboradores e desenvolvedores

“Kodlo Media Replace” é un software de código aberto. As seguintes persoas colaboraron
con este plugin.

Colaboradores

 *   [ Kodlo ](https://profiles.wordpress.org/kodlo/)

[Traduce “Kodlo Media Replace” ao teu idioma.](https://translate.wordpress.org/projects/wp-plugins/kodlo-media-replace)

### Interesado no desenvolvemento?

[Revisa o código](https://plugins.trac.wordpress.org/browser/kodlo-media-replace/),
bota unha ollada ao[repositorio SVN](https://plugins.svn.wordpress.org/kodlo-media-replace/),
ou subscríbete ao [log de desenvolvemento](https://plugins.trac.wordpress.org/log/kodlo-media-replace/)
por [RSS](https://plugins.trac.wordpress.org/log/kodlo-media-replace/?limit=100&mode=stop_on_copy&format=rss).

## Rexistro de cambios

#### 1.0.0

 * First release.

## Meta

 *  Versión **1.0.0**
 *  Última actualización **Fai 4 horas**
 *  Instalacións activas **Menos de 10**
 *  Versión de WordPress ** 6.0 ou superior **
 *  Probado ata **7.1.3**
 *  Versión de PHP ** 7.4 ou superior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/kodlo-media-replace/)
 * Etiquetas
 * [cache](https://gl.wordpress.org/plugins/tags/cache/)[images](https://gl.wordpress.org/plugins/tags/images/)
   [media](https://gl.wordpress.org/plugins/tags/media/)[media library](https://gl.wordpress.org/plugins/tags/media-library/)
   [replace media](https://gl.wordpress.org/plugins/tags/replace-media/)
 *  [Vista avanzada](https://gl.wordpress.org/plugins/kodlo-media-replace/advanced/)

## Valoracións

Aínda non se enviaron valoracións.

[A túa valoración](https://wordpress.org/support/plugin/kodlo-media-replace/reviews/#new-post)

[Ver todas as valoracións](https://wordpress.org/support/plugin/kodlo-media-replace/reviews/)

## Colaboradores

 *   [ Kodlo ](https://profiles.wordpress.org/kodlo/)

## Soporte

Tes algo que dicir? Necesitas axuda?

 [Ver o foro de soporte](https://wordpress.org/support/plugin/kodlo-media-replace/)