WP SVG Images

Description

Securely upload SVG files to your Media Library. Uploaded SVG files are automatically sanitized.

SVG stands for Scalable Vector Graphics and is probably the most efficient way to display images.
WP SVG Images Plugin is an easy-to-use and lightweight plugin that allows you to upload SVG files to your media library safely and easily.

Features

  • Support for SVG uploads to your Media Library.
  • Sanitize uploaded SVG files. Malicious SVG/XML files are rejected from upload.
  • Admin configurable SVG support for different user roles. Ability to disable SVG upload for different user roles.
  • Different user roles can upload and/or sanitize the uploaded SVG images.
  • SVG preview in Media Library.

Support

24/7 SVG support offered by ShortPixel here or here.

Recommended plugins

This plugin is supported & maintained by ShortPixel.
Other popular plugins by ShortPixel:
ShortPixel Image Optimizer – Image optimization & compression for all the images on your website, including WebP delivery – ShortPixel Image Optimizer.
ShortPixel Adaptive Images – On-the-fly image optimization & CDN delivery.
Enable Media Replace – Easily replace images or files in Media Library.
reGenerate Thumbnails Advanced – Easily regenerate thumbnails.
Resize Image After Upload – Automatically resize each uploaded image.

Hooks for developers

WPSVG_setAllowedTags

Allows you to specify more tags that will be not removed during sanitization

add_filter( 'WPSVG_setAllowedTags', 'my_custom_allowed_svg_tags', 10, 1 );
function my_custom_allowed_svg_tags( $tags ){
    $tags[] = 'path';
    return $tags;
}

WPSVG_setAllowedAttrs

Allows you to specify more attributes that will be not removed during sanitization

add_filter( 'WPSVG_setAllowedAttrs', 'my_custom_allowed_svg_attributes', 10, 1 );
function my_custom_allowed_svg_attributes( $attributes ){
    $attributes[] = 'fill';
    return $attributes;
}

Installation

  1. Upload wp-svg-images directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Reviews

juni 8, 2021
I tried a lot of plugins for SVG images, but none is good like this plugin. Greets to author, very powerful plugin. Especially is good for SVG width and height, it's automatically set the width and high of SVG images. Thanks!
apríl 24, 2020 1 reply
WP SVG images let's you upload SVG files to WordPress and shows previews in the media library but the description doesn't clearly state what else the plugin is doing, it just says "Add SVG support to your WordPress web. You can upload SVG files, you can see them as thumbnails in media library, etc." It can't load SVG files that link to external images made with Illustrator CC 2020 unfortunately. I uploaded a test SVG file into a vanilla install of WordPress with the Twenty Twenty theme. I'm not sure if this plugin or WordPress was the problem but external images in the same folder weren't loaded. The developer just said go hire someone as you can't code... I just asked the developer if he could change the description if the plugin had problems. I'm happy to change the review but I can't say this is great or fantastic without proper documentation of what the plugin does in the summary. I came to this plugin's page because I wanted to try some other plugins. That's all. I hope the developer can find out what is happening and can see the sample code I left in the support forum. If this plugin can't load linked folders and the folders don't work even if they are manually uploaded into the same directory it's okay but it's just nice to say stuff like that in the description. This plugin helps upload SVG files but doesn't check if anything is linked to the files. Not sure if it sanitizes SVG code yet.
mars 20, 2020
I tested out a few other SVG plugins....they either were ineffective, mildly buggy, or crashed my site. THIS plugin though...is not just stable, but it operates smoothly. And it is also not a resource hog. It is wonderful. I currently have he latest version of WordPress -- 5.3.2 -- and it works just fine, as of today. I have ajax, jquery, CSS, PHP...basically nothing super weird on my site. I love this plugin. Highly recommended.
Read all 12 reviews

Contributors & Developers

“WP SVG Images” is open source software. The following people have contributed to this plugin.

Contributors

Translate “WP SVG Images” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

4.2

Release date: April 6th, 2023
* Tested on WordPress 6.2;
* Updated SVG sanitizer scripts;
* Skip percentage width and height when reading SVG dimensions.

4.1

Release date: August 1st, 2022
* Tweak: auto hide the settings notice after visiting the settings page;
* Compat: tested the compatibility with WordPress 6.0;
* Fix: the settings link and button from the notice now work fine on all WordPress installs.

4.0

Release date: March 29th, 2022
* New: joined the ShortPixel family;
* New: added SVG sanitization;
* New: added settings page where you can enable/disable SVG upload per user role;
* Compat: deprecated WP_SVG_FOR_EVERYONE.

3.7

  • tested on WordPress 5.9

3.6

  • fix typo in last update

3.5

  • tested on WordPress 5.8
  • fix missing width and height for core/image block

3.4

  • allow SVG uploads only for administrators and editors

3.3

  • tested on WordPress 5.7

3.2

  • tested on WordPress 5.4

3.1

  • tested on WordPress 5.3

3.0

  • added support for Beaver Builder media uploader

2.9

  • tested on WordPress 5.0

2.8

  • fix SVG size as featured image

2.7

  • earlier upload_mimes filter init fix

2.6

  • svg sizing css removed because of many conflicts

2.5

  • fixed svg icon size in plugins updating listing

2.4

  • SVN commit problem

2.3

  • fixed svg icon size in plugins listing

2.2

  • convert svg width and height to float number [PX]

2.1

  • added svg width and height metadata

2.0

  • added svgz support
  • fixed svg thumbnails

1.4

  • repair count() error

1.3

  • 4.9 compatibility

1.2

  • added size calculation fix for wp_get_attachment_image_src

1.1

  • fix for WP4.7.1 bug

1.0

  • First version