Upload SVG through WordPress Media Uploader

One day WordPress will allow SVG uploading out of the box, but until then...

As SVG continues is rise to the top of the internet image food chain you may have found yourself wondering why WordPress gives the security smackdown when uploading SVG through the Media Uploader:


Fix it with this code, either in functions.php or better yet, your own functionality plugin:

 * Adds MIME Types to WP Media Uploader 
 * @since  1.0.0
 * @access public
 * @return void

function spigot_mime_types( $mimes ){
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;

add_filter( 'upload_mimes', 'spigot_mime_types' );

One day I imagine WordPress will allow SVG uploading out of the box, but until then…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check out our Complete Website Package

Chat with us about your project or click below to find out more!

Learn More   Chat with us

Hi. We are Spigot. Telemarketers pronounce it Spy-got.

We are a Park City, Utah based web design shop that excels at building custom websites powered by WordPress and WooCommerce. We love content - content strategy, content curation, content soup...????Have a look around the site. As you browse you'll find useful navigation links in the sidebar on the left. We hope you find them useful anyway... Please let us know what you think, shoot us a message here.