Linux 软件免费装
Banner图

SVG Enabler

开发者 fatih-toprak
optimisthub
更新时间 2026年10月5日 23:36
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

svg svg support svg upload allow svg upload svg sanitizer

下载

1.0.2 1.0.1 1.0.3 1.0.0 2.0.0

详情介绍:

SVG Enabler lets you upload SVG files to the WordPress media library while making sure each file is safe. SVG is an XML format, which means it can carry JavaScript, event handler attributes, external references and XML entities. Uploading an unsanitized SVG is equivalent to allowing arbitrary HTML and JavaScript uploads. This plugin sanitizes every SVG during upload, before the file is written to your uploads directory. What gets removed Features

安装:

INSTALL "SVG Enabler" FROM WITHIN WORDPRESS
  1. Visit the plugins page within your dashboard and select 'Add New';
  2. Search for 'SVG Enabler';
  3. Activate SVG Enabler from your Plugins page;
  4. You are done. Upload an SVG from the media library.
INSTALL "SVG Enabler" MANUALLY
  1. Upload the 'svg-enabler' folder to the /wp-content/plugins/ directory;
  2. Activate the SVG Enabler through the 'Plugins' menu in WordPress;
  3. You are done.

升级注意事项:

2.0.0 Security release. Fixes two sanitizer bypasses and an upstream library affected by CVE-2025-55166, and fixes a fatal error that broke SVG uploads. Upgrading is strongly recommended.

常见问题:

Who can upload SVG files?

By default only administrators (users with the manage_options capability) can upload SVG files. Everyone else is blocked, because SVG is the one image format that can execute code. You can change this with the optimisthub_svg_enabler_capability filter. For example, to let editors upload SVG as well: add_filter( 'optimisthub_svg_enabler_capability', function ( $capability ) { return 'edit_others_posts'; } ); Return an empty string to allow anyone who can upload files.

Can we change the allowed attributes and tags?

Yes, this can be done using the optimisthub_svg_enabler_allowed_attributes and optimisthub_svg_enabler_allowed_tags filters. They take one argument that must be returned. ` add_filter( 'optimisthub_svg_enabler_allowed_attributes', function ( $attributes ) { $attributes[] = 'target'; // This would allow the target="" attribute. return $attributes; } ); add_filter( 'optimisthub_svg_enabler_allowed_tags', function ( $tags ) { $tags[] = 'use'; // This would allow the element. return $tags; } ); `

Why was my SVG rejected?

The file either was not valid XML, did not contain an <svg> root element, or could not be sanitized. Rejected files are never stored. Try re-saving the file with a vector editor such as Inkscape or Illustrator.

Does this plugin make SVG safe to use?

It removes the known dangerous constructs from uploaded SVG files and keeps the sanitizer library up to date. No sanitizer can be considered a complete guarantee, which is why upload permission is restricted to administrators by default. Only upload SVG files from sources you trust.

Does it work with SVGZ?

Yes, .svgz files use the same MIME type and are sanitized the same way.

更新日志:

2.0.0 Security Fixed Changed 1.0.3 1.0.2 - 1.0.1 1.0.0