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.

Related Post

CALL ME
+
Call me!
Share This