{"id":11067,"date":"2026-05-25T22:31:57","date_gmt":"2026-05-25T14:31:57","guid":{"rendered":"https:\/\/aeosub.com\/compatibility-fix-for-safe-svg\/"},"modified":"2026-05-25T22:31:57","modified_gmt":"2026-05-25T14:31:57","slug":"compatibility-fix-for-safe-svg","status":"publish","type":"post","link":"https:\/\/aeosub.com\/zh\/compatibility-fix-for-safe-svg\/","title":{"rendered":"Compatibility Fix for Safe SVG"},"content":{"rendered":"<div class=\"post-img\" style=\"margin-bottom: 25px\"><img decoding=\"async\" src=\"https:\/\/ps.w.org\/compatibility-fix-for-safe-svg\/assets\/banner-1544x500.png?rev=3547754\" alt=\"Compatibility Fix for Safe SVG\" style=\"width: 100%;height: auto;border-radius: 12px\"><\/div>\n<div class=\"plugin-info-card\" style=\"border: 1px solid #e2e8f0;border-radius: 10px;overflow: hidden;margin-bottom: 30px;font-family: -apple-system, system-ui, sans-serif;background: #fff\">\n<table style=\"width: 100%;border-collapse: collapse;font-size: 14px\">\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 15px 20px;text-align: left;width: 35%;color: #4a5568;background: #fcfcfc\"><img decoding=\"async\" src=\"https:\/\/ps.w.org\/compatibility-fix-for-safe-svg\/assets\/icon.svg?rev=3547754\" style=\"width: 40px;height: 40px;border-radius: 6px;margin-right: 12px;vertical-align: middle\"> Developer<\/th>\n<td style=\"padding: 15px 20px;font-weight: 500\"><a href=\"https:\/\/profiles.wordpress.org\/jgorres\/\" target=\"_blank\" rel=\"noopener\">jgorres<\/a><\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Version<\/th>\n<td style=\"padding: 12px 20px\">v1.1.1<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Active Installs<\/th>\n<td style=\"padding: 12px 20px\">0 +<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Requires \/ Tested<\/th>\n<td style=\"padding: 12px 20px\">6.5 \/ 6.9.4<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Last Updated<\/th>\n<td style=\"padding: 12px 20px\">2026-05-25 2:25pm GMT<\/td>\n<\/tr>\n<tr>\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Official Link<\/th>\n<td style=\"padding: 12px 20px\"><a href=\"https:\/\/wordpress.org\/plugins\/compatibility-fix-for-safe-svg\/\" target=\"_blank\" style=\"text-decoration: none;color: #4a3bca;font-weight: bold\" rel=\"noopener\">View Details \u2192<\/a><\/td>\n<\/tr>\n<\/table><\/div>\n<div class=\"plugin-short-desc\" style=\"margin: 20px 0;padding: 12px 15px;background: #f9fafb;border-left: 4px solid #4a3bca;border-radius: 6px;font-style: italic;color: #4a5568\">Fixes a conflict between &quot;Safe SVG&quot; and &quot;Enable Media Replace&quot; when replacing existing media files with SVG uploads.<\/div>\n<p><strong>Problem:<\/strong><\/p>\n<p>With &#8220;Safe SVG&#8221; 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 <strong>&#8220;Enable Media Replace&#8221;<\/strong> plugin, the operation aborts with the message <em>&#8220;Sorry, this file type is not permitted for security reasons.&#8221;<\/em>.<\/p>\n<p>Root cause: EMR calls <code>wp_check_filetype_and_ext()<\/code> directly from its own submenu (<code>upload.php?page=enable-media-replace\/...<\/code>) without going through the standard upload path (<code>wp_handle_upload<\/code>). Safe SVG, however, registers its MIME-type fix only on certain admin page hooks \u2014 and those do not reliably fire on the EMR replace page in practice.<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>This plugin registers the two required filters (<code>upload_mimes<\/code>, <code>wp_check_filetype_and_ext<\/code>) globally so that SVG uploads work through EMR as well.<\/p>\n<p><strong>Safety guard:<\/strong><\/p>\n<p>So that this plugin does not open an unsanitized SVG upload path, the filters are active only when the &#8220;Safe SVG&#8221; plugin itself is active. Safe SVG then handles the SVG sanitization on <code>wp_handle_upload_prefilter<\/code> \/ <code>wp_handle_sideload_prefilter<\/code>. Without an active Safe SVG, SVG remains non-uploadable.<\/p>","protected":false},"excerpt":{"rendered":"<p>Fixes a conflict between &quot;Safe SVG&quot; and &quot;Enable Media Replace&quot; when replacing existing media files with SVG uploads.<\/p>","protected":false},"author":1,"featured_media":9317,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[252],"tags":[2032,2033,2034,2035,2036,555],"class_list":["post-11067","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-trends","tag-compatibility","tag-enable-media-replace","tag-mime","tag-safe-svg","tag-svg","tag-wordpress-plugin"],"_links":{"self":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts\/11067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/comments?post=11067"}],"version-history":[{"count":0,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts\/11067\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/media\/9317"}],"wp:attachment":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/media?parent=11067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/categories?post=11067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/tags?post=11067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}