When you’ve got ever tried to add an SVG (Scalable Vector Graphics) file for a emblem or favicon in WordPress, you might have been astonished to seek out that it doesn’t work. There isn’t a core assist so customers depend on plugins like SVG Support (900K+ installs) or Safe SVG (600k+ installs) to add SVG recordsdata to the media library and use them like every other picture file.
The principle benefit of SVG recordsdata is they will scale to any dimension with out dropping high quality. They’re additionally compact and Search engine optimization-friendly as a result of they’re saved in XML textual content recordsdata that may be crawled and listed.
WordPress contributors have been discussing adding SVG support for greater than 9 years. It was talked to demise with numerous proofs of idea and no clear path ahead, and the ticket finally turned a spot the place individuals periodically cease by and comment that it’s “a goddamn tragedy that WordPress doesn’t assist this but.”
Regardless of the format having nearly universal support across the web, there are safety considerations related to scripted SVGs, the place recordsdata would possibly include a malicious script. With out an SVG sanitizer library, customers can be importing SVG recordsdata at their very own threat.
In probably the most recent Performance Team meeting, contributors proposed the concept of engaged on a brand new SVG uploads module. They’re first aiming to allow users to upload SVG files without scripts and supply an SVG preview within the Media Library.
Though greater than one million WordPress customers have put in a plugin so as to add SVG uploads to their websites, none of those plugins are function plugins. Because of this the Efficiency Crew has opted to create a module inside the Efficiency Lab plugin. It permits the workforce to raised take a look at the function within the wild earlier than proposing it for WordPress core.
Taking a look at present implementations in plugins, the workforce discovered lots of them provide extra options than the scope of this module would come with. The most well-liked plugins all at present use the SVG Sanitizer library, as does a Drupal module and an integration for TYPO3 CMS.
Efficiency workforce contributors have recognized WordPress 6.2 as a sensible objective for proposing the module for core. Anybody who needs to contribute can join their efforts on GitHub.