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.

The Most Popular Hosting Period

I Recommend Divi From Elegant Themes

Ezoic Ads

Disclousre

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.

 

Pin It on Pinterest

Share This