If you have ever tried to upload an SVG (Scalable Vector Graphics) file for a logo or favicon in WordPress, you may have been astonished to find that it doesn’t work. There is no core support so users rely on plugins like SVG Support (900K+ installs) or Safe SVG (600k+ installs) to upload SVG files to the media library and use them like any other image file.

The main advantage of SVG files is they can scale to any dimension without losing quality. They are also compact and SEO-friendly because they are stored in XML text files that can be crawled and indexed.

WordPress contributors have been discussing adding SVG support for more than nine years. It was talked to death with various proofs of concept and no clear path forward, and the ticket eventually became a place where people periodically stop by and comment that it’s “a goddamn tragedy that WordPress doesn’t support this yet.”

Despite the format having nearly universal support across the web, there are security concerns associated with scripted SVGs, where files might contain a malicious script. Without an SVG sanitizer library, users would be uploading SVG files at their own risk.

In the most recent Performance Team meeting, contributors proposed the idea of working on a new SVG uploads module. They are first aiming to allow users to upload SVG files without scripts and provide an SVG preview in the Media Library.

Although more than a million WordPress users have installed a plugin to add SVG uploads to their sites, none of these plugins are feature plugins. This is why the Performance Team has opted to create a module within the Performance Lab plugin. It allows the team to better test the feature in the wild before proposing it for WordPress core.

Looking at current implementations in plugins, the team found many of them offer more features than the scope of this module would include. The most popular plugins all currently use the SVG Sanitizer library, as does a Drupal module and an integration for TYPO3 CMS.

Performance team contributors have identified WordPress 6.2 as a realistic goal for proposing the module for core. Anyone who wants to contribute can join their efforts on GitHub.

Category: News, WordPress

Source