Oh man, WordPress 5.0 is becoming more of a problem than I thought.

So, something that I’ve noticed is that SVG files are not uploading. UGH.

I use a lot of SVG files.

Yeah, there’s a security risk, which happens because some punks hide bad code in their SVG files and give them out. But since I make my own SVG files, and check the code before I upload anything, I’m OK… and y’all should too.

Oh, tip:

If you have to get your vector files from places like flaticon.com, then, get the eps, and open it in Illustrator, and then export it. (I’m sure they have clean svg files, but I rarely use unedited files anyway..)

So, here’s the problem.

Suddenly, all my builds started telling me this


Sorry, this file type is not permitted for security reasons.


First things first

Here is the code that allows svg uploads.

//add SVG to allowed file uploads
function add_file_types_to_uploads($file_types){

    $new_filetypes = array();
    $new_filetypes['svg'] = 'image/svg+xml';
    $file_types = array_merge($file_types, $new_filetypes );

    return $file_types;
add_action('upload_mimes', 'add_file_types_to_uploads');

Add that to the bottom of your functions.php file.

You should have a child theme, add this to the bottom of the child theme’s functions.php file. Get a free Divi child theme here, which has this code already included.


But it doesn’t work anymore. WHY NOT????? (btw, even svg plugins won’t work either. ugh)

The answer is here.. but who cares, it doesn’t work, and we need to make it work.

The fix

Step 1. Keep the code intact.

Yeah, that code is correct, it’s just the WP has blocked it for some reason, and it’ll come back soon. (probably) So yeah, leave it.


Step 2. Add this to the svg files.

So open the svg file in a text editor, and add this in the front.

<?xml version="1.0" encoding="utf-8"?>

Turns out this will fix it. huh.

At the moment, it’s not the svg files that are the problem, it’s WP being cranky.


BUT, unfortunately, the easiest fix for this is to edit the svg files.

So yeah, anyways, that’s how you can upload svg files again. UGH.


I’m not happy with WP 5. I’ll have Gutenberg + Divi review up soon.


Photo by Sandro Katalina on Unsplash

ps. I’ve seen that 4.9.9 has the same problem.. and this will fix it just the same.

Update: it seems that the SafeSVG plugin can circumvent this problem easily. So there you go. Problem solved. haha. I’mma go install that now.



Hi! Please consider signing up for my newsletter for... two emails (at most) a month of news, updates, and special offers, including child themes and more courses. Sound interesting? The signup form is right here!

You will also get a discount coupon in your inbox as soon as you sign up!