SVG image upload stopped working

By default, WP does not allow SVG uploads, and you should get that error. Preventing SVG uploads is a security feature (which I explain below). I can’t help you debug your function, because that is beyond my expertise, but I can suggest a work around.

You can use a plugin like SafeSVG (https://wordpress.org/plugins/safe-svg/) to enable SVG, but use caution: it exposes you to risks. SVG files can be used as a way of taking over control of your site. If you install the plugin and enable SVG upload you should be able to restore your ability to upload the SVGs. However, I recommend, for security reasons you restrict access to the plugin to the administrator in your functions.php file. If you have users that have upload capacities, they could hack/corrupt/compromise your site with SVGS, so be careful!

UPDATE 1: Because of your question, I just discovered that even safeSVG (which I had been using) stopped working. It seems that SVG upload (an maybe even upload of some other file types) has been broken by the recent WP 4.7.1 update. There is a discussion about it here: https://wordpress.org/support/topic/wp-4-7-1-kills-svg/

There are a number of solutions in that discussion, and some appear to be safer than others. I haven’t tested them though. It is a start. I’m glad I ran across your question. Thanks!

UPDATE 2: Here is a plugin that a commenter below suggested to temporarily allow this, but I cannot vouch for the safety: https://wordpress.org/plugins/disable-real-mime-check/

Leave a Comment