Linux 软件免费装
Banner图

Media Switcheroo

开发者 idesolutions
更新时间 2026年11月6日 22:26
PHP版本: 8.0 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

media library replace image media replace cache clear replace pdf

下载

1.0.0

详情介绍:

Media Switcheroo is a WordPress plugin for replacing files already stored in the Media Library without changing the attachment ID or existing media URL. It is designed for common maintenance tasks such as replacing an updated image, PDF, document, download, or other WordPress-supported attachment while keeping existing references intact. Features Who can use it Users who can upload files and edit the media item (or manage the site) can replace it. Replacement files are checked against the file types your site already allows.

安装:

  1. Upload the media-switcheroo folder to /wp-content/plugins/ or install the ZIP through Plugins > Add New > Upload Plugin.
  2. Activate Media Switcheroo.
  3. Go to Media > Media Switcheroo or use the Replace File action for an existing Media Library item.
  4. Select a replacement file with the same file extension.
  5. Select Replace Media.

屏幕截图:

  • Current media and replacement-file interface.
  • Replace File action in the Media Library.
  • Replace Media File option in Attachment Details.

常见问题:

Why must the replacement use the same extension?

This plugin keeps the existing Media Library URL. Requiring the same file extension prevents an existing .jpg URL from suddenly containing PDF data, or similar mismatches that can break browsers, servers, and existing links.

Will the attachment ID change?

No. The existing WordPress attachment record is preserved.

Will my alt text, title, caption, and description stay?

Yes. The plugin changes the underlying file, not the attachment's editorial information.

Are image thumbnails regenerated?

Yes. WordPress attachment metadata and registered image sizes are regenerated after replacement, and image sizes that no longer apply are removed.

Does it clear caches?

Yes. The plugin clears the cached data WordPress holds for the replaced file and attempts to purge supported page-cache, hosting, optimization, and builder caches that are detected on the site. It does not flush your whole object cache unless you ask it to. Developers can use the media_switcheroo/cache/purge action to integrate additional cache systems, or return true from the media_switcheroo/flush_object_cache filter to also flush the entire object cache.

Why does the plugin add a query string to replaced images?

The replacement keeps the same URL, which can cause browsers and CDNs to continue showing a cached copy of the old file. A replacement version is appended to media URLs on the public site so a new replacement produces a new cache key. It is not added in the admin or in the editor, so it is never saved into your posts.

Can I replace SVG files?

Only if your site already allows SVG uploads. The plugin then checks the replacement before installing it and rejects SVG files that contain scripts, embedded HTML, event handlers, or references to anything outside the file (external images, links, stylesheets, or imports).

Does it send any data anywhere?

No. The plugin makes no external requests and does not track anything.

What does it do when the plugin is deleted?

It removes the replacement version, date, and user values it stored on media items. Your media files and their details are not touched.

更新日志:

1.0.0