Compatibility Fix for Safe SVG
Fixes a conflict between "Safe SVG" and "Enable Media Replace" when replacing existing media files with SVG uploads.
Install in
Problem:
With “Safe SVG” alone, uploading SVG files into the WordPress Media Library works fine. As soon as you try to replace an existing file with an SVG via the “Enable Media Replace” plugin, the operation aborts with the message “Sorry, this file type is not permitted for security reasons.”.
Root cause: EMR calls 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.
Written by Joobi from the project's own listing. See the source page
1.2.0
- Adds a friendly, dismissible request for a review on WordPress.org, shown to administrators on the dashboard and the plugin list once the plugin has been active for 14 days, and only while Safe SVG is active. Each administrator decides separately: rate, remind later or never show again. No data is sent.
- New
uninstall.php: deleting the plugin removes the data of the review request.
1.1.3
- Plugin header:
Plugin URIlinks to the source code repository on GitHub;Tested up tois declared in the readme only. No code changes.
1.1.2
- Compatibility:
Tested up toraised to WordPress 7.1. No code changes. - Assets: cosmetic corrections to the banner graphics on WordPress.org.
1.1.1
- Metadata:
Contributorsslug inreadme.txtchanged fromjoerngorrestojgorresto match the WordPress.org user name. No code changes.
1.1.0
- Plugin renamed from “Safe SVG Upload Fix” to “Compatibility Fix for Safe SVG” (slug:
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. - Function prefix
ssuf_compatibility_fix_for_safe_svg_. - Removed the capability check (
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. - Plugin header description translated to English.
- Added a
languages/index.phpstub against direct access. - Translated all
readme.txtsections (Installation, FAQ, Changelog, Upgrade Notice) to English.
1.0.1
- Plugin Check compliance, no functional changes: Short Description and
== Description ==translated to English.
1.0.0
- Initial release.
- Registers the
upload_mimesandwp_check_filetype_and_extfilters globally, gated by an active-Safe-SVG check.
Follow this listing's changes (Atom feed)