Just another contact form plugin. Simple but flexible.
About Safe SVG
Safe SVG is a WordPress plugin that allows you to upload SVG files to your website while ensuring they are safe and free from vulnerabilities. It also includes features such as optimizing SVG files for space saving and previewing uploaded SVGs in the media library. You can choose to restrict SVG uploads to certain users or allow anyone to upload.Frequently asked questions
What does Safe SVG do?
Safe SVG enables SVG uploads in WordPress and sanitizes them to prevent XML/SVG vulnerabilities. It also allows users to preview uploaded SVGs in the media library.
Does Safe SVG optimize SVG files?
Yes, Safe SVG can optimize SVGs using the SVGO tool on upload, though this feature is disabled by default. It can be enabled with a filter.
Can I control who can upload SVGs?
Yes, Safe SVG allows you to restrict SVG uploads to specific users or permit all users to upload them.
How does Safe SVG ensure security?
Safe SVG sanitizes uploaded SVG files to prevent security vulnerabilities. This sanitization is performed using the svg-sanitizer library.
Changelog
2.5.2 – 2026-10-26
- Added: New filter,
safe_svg_max_inflated_size, allowing you to increase or decrease the max size an SVG can inflate to (GHSA-xjvq-4jwj-3mwq). - Security: Updates the underlying
enshrined/svg-sanitizepackage to v1.1.0 (#355). - Security: Resolve GHSA-xjvq-4jwj-3mwq (GHSA-xjvq-4jwj-3mwq).
- Security: Resolve GHSA-xpv8-cx9q-v65f (GHSA-xpv8-cx9q-v65f).
- Security: Resolve GHSA-h56m-22q9-r6xc (GHSA-h56m-22q9-r6xc).
- Security: Resolve GHSA-vm75-mq6x-x57m (GHSA-vm75-mq6x-x57m).
2.5.1 – 2026-09-22
- Added: New REST endpoint,
/safe-svg/v1/svg/ATTACHMENT-ID, that can be passed an attachment ID for an SVG and will return sanitized markup (props @dkotter, @peterwilsoncc via GHSA-3hhm-5qc9-q4xf). - Removed: Remove the
$sanitizerproperty from thesafe_svgclass. If you directly use thesafe_svgclass in order to access the$sanitizerproperty, you’ll need to update your code to instead use the newSvg_Sanitizerclass (props @dkotter, @peterwilsoncc via GHSA-3hhm-5qc9-q4xf). - Security: Resolve GHSA-qq4c-2xh7-x2wf (props @dhakalananda, @dkotter, @peterwilsoncc, @darylldoyle, @jeffpaul via GHSA-qq4c-2xh7-x2wf).
- Security: Resolve GHSA-vcfp-vw5v-gc9c (props @spectreDeveloper, @dkotter, @peterwilsoncc, @darylldoyle, @jeffpaul via GHSA-vcfp-vw5v-gc9c).
- Security: Resolve GHSA-3hhm-5qc9-q4xf (props @dkotter, @peterwilsoncc via GHSA-3hhm-5qc9-q4xf).
2.5.0 – 2026-09-07
- Security: Prevented direct access of PHP files (props @mehrazmorshed, @dkotter via #300).
- Security: The Inline SVG block now renders SVGs that carry their own
<style>element inside a shadow root, so their CSS is scoped to the block instead of applying to the whole page (props @0xb1lal, @darylldoyle, @dkotter, @jeffpaul, @peterwilsoncc via #328, GHSA-6w27-923c-c64m). - Security: Bump
enshrined/svg-sanitizefrom^0.22.0to^1.0.0to pull in security fixes (props @dkotter, @jeffpaul, @peterwilsoncc via #327). - Added: Link support for the SVG Inline block, including URL input, new tab toggle, and nofollow/sponsored rel options (props @vegetable-bits, @mgiannopoulos24, @jeffpaul, @thrijith, @peterwilsoncc, @dkotter, @pbiron via #315).
- Added: New
safe_svg_inline_use_shadow_domfilter to control which inline SVGs are isolated in a shadow root, and newsafe_svg_inline_shadow_stylesfilter to adjust the CSS injected alongside them (props @darylldoyle, @dkotter, @jeffpaul, @peterwilsoncc via #328). - Added: New
safe_svg_remove_remote_referencesfilter to strip remoteurl(),@importandimage-set()references, along with remotehreftargets, from uploaded SVGs. Off by default, because legitimate SVGs reference remote fonts and images but use this filter to turn it on (props @darylldoyle, @dkotter, @jeffpaul, @peterwilsoncc via #328). - Added: Added support for Enable Media Replace plugin (props @gthayer, @jeffpaul, @peterwilsoncc via #285).
- Changed: Bump WordPress minimum supported version to 6.9 (props @zamanq, @peterwilsoncc via #320).
- Changed: Bump “tested up to header” to indicate WordPress 7.1 support (props @navi151, @peterwilsoncc, @dkotter, @jeffpaul, @zamanq via #290, #311, #320).
- Changed: Theme CSS can no longer target an inline SVG that carries its own
<style>element, because stylesheets cannot reach into a shadow root. Style those SVGs from within the SVG itself, or opt out with thesafe_svg_inline_use_shadow_domfilter. Inherited properties, includingcolor/currentColorand custom properties, still apply as before, and SVGs without a<style>element are unaffected (props @darylldoyle, @dkotter, @jeffpaul, @peterwilsoncc via #328). - Changed: Updated blueprint file for WordPress.org live previews (props @fellyph, @jeffpaul, @peterwilsoncc via #287).
- Changed: Bump
svgofrom 3.2.0 to 3.3.5 (props @dependabot[bot], @jeffpaul, @peterwilsoncc, @dependabot via #309).
