Did something change in how adding filetypes works with CP?


#1

I used this function to be able to upload svg

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

But it no longer works. Is this a CP thing or?


#2

I guess not, can you double check if the quotes are correct? sometimes copy/paste can cause some damage.

The code worked fine for me.
CloudApp


#3

Yes, looks to me like you have smart quotes in there? Would that break things?


#4

I have rewritten the entire function by hand and it’s still not working. debugging is also not giving an error_log


#5

We have found the solution. It wasn’t the code. We needed to add this to the SVG’s themselves

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

#6

This was probably part of the changes in WordPress 4.9.9 and 5.0.1.