Use SVG in WordPress for Perfect Graphics without a plugin

by | Mar 24, 2016

Can I use SVG in WordPress?

While SVG in WordPress isn’t natively allowed to be uploaded to a WordPress website there is a workaround. With a simple code placed in your functions.php file, you can be uploading SVG files in no time all without an extra plugin. Watch the video or scroll down and grab the code.

WordPress SVG Security

Use caution when using this method on websites where you allow files to be uploaded by users on their end. There could be some security issues by allowing users to upload this file type hence the lack of support from the WordPress template files. SVG is not a supported file in WordPress so you won’t get far if you try before using this method.

Embed The Code

This is a great place to get started in using .svg’s in WordPress which will bring scalable, lossless graphics into your unique web design. Take this code and place it into your child theme’s function.php file.

Here is the code:

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

The rest is up to you. Get coding, add transitions with css and feel free to share your results below.

Subscribe On Youtube

I appreciate you reading and watching my content. If you haven’t already, please consider subscribing to my YouTube channel as it really helps the channel grow so I can continue doing what I do for you.

Thank You For Your Support

Get Started With Bluehost

Disclosure

This site is monetized with affiliate links to companies like Elegant Themes, Blue Host, Amazon, and others that pay a small commission if you purchase a product through a link on this website.

This allows me to continue to produce great content for this site and I appreciate your support. All products recommended by me are both used and approved by myself.

I Recommend Divi From Elegant Themes

Powerful Forms With Ninja Forms

Ninja Forms

Monetize Your Sites With Ezoic Ads