We have recently relocated to Mission Viejo, CA

Return to Resources

Unable to upload SVGs to WordPress

Written by Erick Olivares

By default, WordPress doesn’t let you upload SVG images. It’s a common problem web editor to upload high-resolution images onto their websites. Recently WordPress made modifications which made it more difficult to upload SVG’s.

In your functions.php file try adding this snippet of code.

function my_own_mime_types( $mimes ) {
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}
add_filter( 'upload_mimes', 'my_own_mime_types' );

After WordPress 4.7 or 4.8 this code might not be sufficient. Try sanitizing your SVG file– we thought something was wrong with the code above, but sanitizing the SVG proved to be the missing step.

svg.enshrined.co.uk

Subscribe to receive resource updates to your inbox.

Resources