Did something change in how adding filetypes works with CP?

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?

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.
https://cl.ly/66fc107a3558

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

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

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"?>
1 Like

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

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.