Linux 软件免费装
Banner图

Smart Media Replacement

开发者 areziaal
更新时间 2026年5月15日 22:47
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

media pdf attachment replace revisions

下载

1.0.0 1.1.0 1.1.1 1.2.0 1.2.1

详情介绍:

Ever updated a PDF and realized half your site links to the old version? Or replaced a hero image and watched your carefully-tuned page layout collapse? Smart Media Replacement solves both problems — and adds a safety net you'll wish you had earlier. Replace the file, keep the URL. When you swap an attachment with this plugin, the file's URL never changes. Every existing link, every email that points to it, every page that embeds it, every SEO ranking — all of it keeps working. No 404s, no broken references, no scrambling to update old content. Full revision history, one-click restore. Every replacement automatically snapshots the previous version. Made a mistake? Roll back instantly. Want to see what the file looked like three months ago? Download it. Each revision is timestamped, attributed to the user who made it, and can carry an optional note describing what changed. Works where you work. Replace from the Media Library, or from inside any block's Replace toolbar in the block editor — image, cover, video, audio, file, gallery, and more. The editor refreshes in place, no page reload, no lost work. Safe by default. The plugin validates filenames, file types, and image dimensions to keep your URLs intact and your layouts unbroken. WordPress's auto-scaled images are handled transparently. Revisions land in a database table that's self-healing on every admin load, and the plugin's settings page gives you control over how many revisions to keep, how long to retain them, and which file types are tracked. Use cases Features Replacement and URL preservation Revision history Block editor integration Validation safeguards Built-in admin Multisite-ready WP-CLI Other Privacy This plugin is fully self-contained and respects your privacy:

安装:

  1. Install from the WordPress plugin directory, or upload the smart-media-replacement folder to /wp-content/plugins/
  2. Activate through the Plugins menu in WordPress
  3. (Optional) Visit Media → Replacement Settings to configure revision history behavior
Multisite On WordPress multisite the plugin is network-activate only — activate it once from Network Admin → Plugins, then configure it at Network Admin → Settings → Media Replacement. The settings you choose apply to every site on the network. There is no per-site settings page on multisite.

屏幕截图:

  • Pick a replacement file and add an optional note describing what changed.
  • Replacements are validated against the original — file type, filename, and image dimensions — so URLs stay stable and layouts stay intact.
  • Replace files or view revisions directly from the Media Library row actions.
  • Same replacement flow from the attachment edit screen, with the optional replacement note.
  • Browse, restore, or download past versions — or grab the full history as a ZIP — all from one panel.
  • Configure revision retention, file-type tracking, comment requirements, and deactivation cleanup from one settings page.

常见问题:

Will my existing links still work after I replace a file?

Yes — that's the whole point. The replacement keeps the file's URL and ID unchanged, so every existing link, embed, share, and SEO reference continues to work normally.

Can I undo a replacement if something goes wrong?

Yes. As long as revisions are enabled for the file type, every replacement preserves the previous version. Open the file's revision history and click Restore on any past version. The current file is also snapshotted before the restore, so nothing is lost.

Does this work in the block editor?

Yes. Every block that has a Replace toolbar — image, cover, video, audio, file, gallery, media-text, post-featured-image — gets an Update existing file option in the Replace dropdown. The editor refreshes in place after replacement, so you don't lose unsaved work.

What happens to image thumbnail variants after replacement?

WordPress regenerates all configured image sizes (thumbnail, medium, large, etc.) automatically. Their URLs stay stable too, so responsive images and srcset attributes continue working.

Can I download a previous version of a file?

Yes. Each revision has its own Download button. You can also download a ZIP archive containing every revision for a file at once.

Why must my replacement file have the same name as the original?

That's how WordPress serves files — the URL contains the filename. Matching the original filename is what keeps your existing links intact. The plugin shows you the exact filename to use if there's a mismatch.

Why must image dimensions match?

Different dimensions can break responsive layouts, hero image sizing, and carefully-tuned cropping across your site. Enforcing identical dimensions protects against unexpected layout shifts. Developers can disable this per-attachment with the smart_media_replacement_enforce_dimensions filter if needed.

Can I replace a JPG with a PNG?

No. The replacement file must be the same MIME type as the original. Mixing file types can break image processing, browser display, and SEO. If you need to change formats, upload as a new image.

What if my image was scaled by WordPress?

If WordPress automatically created a -scaled variant (typical for uploads over 2560px), upload your replacement with the original filename — without the -scaled suffix. The plugin handles the scaling and regenerates all variants automatically. If you upload with the wrong filename, the error message will tell you exactly what name to use.

I have revisions enabled but I don't see any history. Why?

Revisions are created on replacement, not on the original upload — so a brand-new attachment shows no history until you've replaced it at least once. Also check Media → Replacement Settings: the "Enable Revisions For" option lets you scope revisions to documents only, images only, or all file types. If your attachment's type isn't covered, no revisions will be tracked.

Is there a WP-CLI interface?

Yes. The plugin ships with wp smr db check, wp smr db repair, wp smr db status, and wp smr db cleanup. These are useful in deployment pipelines, after database restores, and on large multisite networks where you want to run retention cleanup on a real system cron instead of relying on WP-Cron. All commands support --network and --site-id=<id> on multisite; wp smr db cleanup also accepts --dry-run and --yes.

Do I need special permissions?

Yes — you need the edit_post capability for the specific attachment. This matches WordPress's standard media editing permission model.

更新日志:

What's new in 1.2.0 Multisite behavior is now consistent and centrally managed. Upgrading on multisite: per-site settings stored under v1.1.x are not carried forward to the network store. After upgrading, a super admin should visit Network Admin → Settings → Media Replacement once and confirm the values. Single-site installs are unaffected. What's new in 1.1.1 A major feature release. Revision history, block editor integration, and a handful of reliability improvements for managed hosts. New features Reliability improvements Security hardening View all version changes 1.0.0