Skip To Content

Scaleable Vector Graphics Upload Support into WordPress

Kevin Doherty

Creative Director

Date

Nov. 6, 2014

Scaleable Vector Graphics (SVG) is all the praise in a modern developer’s toolkit these days. Most modern browsers these days offer full support and we’re finally transitioning into a somewhat balanced browsersphere and not having to provide fall back after falling back.

Uploading Scaleable Vector Graphics into WordPress

The first time I tried to upload and .svg into WordPress I was greeted by this lovely error:

svg-error

The Code Fix

To overcome this speed bump, simply add this to your theme’s functions.php file.

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

Pretty simple fix and now you can add Scaleable Vector Graphics graphics to your site.

Read More

Read More About

Book with us

Let’s accomplish what you are looking for, our team of experts are here for you.

Let's work together

Warning: Working with our team may result in excessive creativity, uncontrollable 'aha' moments, and an addiction to perfect pixels. Please proceed with caution.