Skip to content

About

A powerful WordPress plugin that enables SVG uploads and provides advanced features for working with SVG files in WordPress.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Repository files navigation

SVG Support

Active Installs Rating Required PHP Version Required WP Version WordPress tested up to version GPLv2 License Playground Demo: Stable Playground Demo: Dev

A powerful WordPress plugin that enables SVG uploads and provides advanced features for working with SVG files in WordPress.

Development Repository

This GitHub repository is the development workspace for SVG Support and may be ahead of the released version. For production sites, install the official release from the WordPress.org plugin repository.

Releases are published to WordPress.org via SVN; this repository is used for development and issue tracking.

Description

SVG Support allows you to securely upload SVG files to your WordPress Media Library and use them like any other image, with additional features for inline rendering, styling, and animation.

Key Features

  • SVG Upload Support: Easily upload SVG files to your media library
  • Automatic Sanitization: All SVG uploads are sanitized by default for security
  • Minification Options: Reduce SVG file sizes with optional minification
  • Inline Rendering: Render SVG code inline by adding the "style-svg" class
  • Role-Based Control: Restrict SVG upload capabilities to specific user roles
  • Custom Target Class: Define your own CSS class for targeting SVGs
  • Featured Image Support: Special handling for SVG files as featured images
  • Advanced Mode: Toggle advanced features for more control

Installation

  1. Install through the WordPress plugin repository or upload to your /wp-plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to "Settings > SVG Support" to configure the plugin

Basic Usage

Once activated, you can upload SVG files to your media library like any other image file.

Inline SVG Rendering

To render an SVG inline (enabling CSS/JS targeting of internal elements):

<img class="style-svg" alt="alt-text" src="image-source.svg" />

Or with a custom class:

<img class="your-custom-class" alt="alt-text" src="image-source.svg" />

Security

SVG Support takes security seriously and provides several features to ensure safe SVG handling:

  • Sanitization by default (since v2.5.8)
  • Role-based upload restrictions
  • Optional sanitization bypass for trusted users
  • Secure file handling through WordPress APIs

Development

This is the development repository for SVG Support. The official release version is maintained on WordPress.org's SVN repository.

Working on assets

No build tool is required. Stylesheets in css/ are plain CSS — edit them directly. If you change any front-end/editor JavaScript (js/svgs-inline.js, js/svgs-inline-vanilla.js, js/gutenberg-filters.js), regenerate the minified copies and commit them with your change:

bin/build-assets.sh

The script uses npx terser, so Node.js is the only prerequisite.

Quick Test

Want to try it out? Spin up a test site instantly: Click here to create a test site with SVG Support pre-installed

Contributing

Contributions are welcome! Feel free to:

Support

License

This plugin is licensed under the GPL v2 or later.

Author

Created and maintained by Benbodhi

Follow SVG Support

Support the Development

If you find this plugin useful, please consider:

About

A powerful WordPress plugin that enables SVG uploads and provides advanced features for working with SVG files in WordPress.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages