[WordPress] 外掛分享: Compatibility Fix for Safe SVG

首頁外掛目錄 › Compatibility Fix for Safe SVG
WordPress 外掛 Compatibility Fix for Safe SVG 的封面圖片
10+
安裝啟用
尚無評分
67 天前
最後更新
問題解決
WordPress 6.5+ PHP 7.4+ v1.1.1 上架:2026-05-24

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Compatibility Fix for Safe SVG」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon