| 开发者 | jgorres |
|---|---|
| 更新时间 | 2026年5月25日 22:25 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPL v2 or later |
| 版权网址: | 版权信息 |
wp_check_filetype_and_ext() directly from its own submenu (upload.php?page=enable-media-replace/...) without going through the standard upload path (wp_handle_upload). Safe SVG, however, registers its MIME-type fix only on certain admin page hooks — and those do not reliably fire on the EMR replace page in practice.
Solution:
This plugin registers the two required filters (upload_mimes, wp_check_filetype_and_ext) globally so that SVG uploads work through EMR as well.
Safety guard:
So that this plugin does not open an unsanitized SVG upload path, the filters are active only when the "Safe SVG" plugin itself is active. Safe SVG then handles the SVG sanitization on wp_handle_upload_prefilter / wp_handle_sideload_prefilter. Without an active Safe SVG, SVG remains non-uploadable.
Yes. Without Safe SVG the filters of this plugin stay inactive. This is intentional: SVG uploads without a sanitizer would be an XSS risk (embedded JavaScript / SVG smuggling).
Yes. The two filters are generic and apply to any plugin that calls wp_check_filetype_and_ext() directly.
Yes. As of version 1.1.0 the filters no longer perform a capability check, so SVG uploads also work in contexts without a logged-in user (for example programmatic sideloads via REST or WP-CLI). Security is still enforced through the Safe-SVG-active guard and Safe SVG's sanitization on wp_handle_upload_prefilter.
No. The plugin can be deactivated and removed without leftovers (no postmeta, no options, no cron).
Contributors slug in readme.txt changed from joerngorres to jgorres to match the WordPress.org user name. No code changes.compatibility-fix-for-safe-svg). Reason: the WP.org Plugin Directory does not accept plugin names that start with the name of another plugin; the "for Safe SVG" pattern is explicitly allowed.ssuf_ → compatibility_fix_for_safe_svg_.current_user_can( 'upload_files' )) from the filter callbacks. As a result SVG uploads now also work in non-user contexts (WP-CLI, Cron, REST sideloads). Security is still guaranteed by the Safe-SVG-active guard and Safe SVG's sanitizer hook.languages/index.php stub against direct access.readme.txt sections (Installation, FAQ, Changelog, Upgrade Notice) to English.== Description == translated to English.upload_mimes and wp_check_filetype_and_ext filters globally, gated by an active-Safe-SVG check.