You may be using a WordPress plug-in, or edited your functions.php file to allow SVG files into your media library, but you’re still being prevented by WordPress from doing so. Annoying, huh? Well, it may actually be the SVG itself that’s the problem.
SVG and XML sitting in a tree…
The more recent versions of WordPress – 4.5 onwards, I think – require the SVG file to have a correct XML header. Though this may seem fussy, it’s perfectly correct to do so as SVG is extended from XML. Ok, it is being fussy, but there you have it.
- Open your SVG in a code editor.
- Check to see if it has an XML header.
- If not, add it (shown in bold below) and save the file.
<?xml version="1.0" encoding="UTF-8" ?>
<svg width="400" height="200" viewBox="0 0 400 200" xmlns="http://www.w3.org/2000/svg"> ... </svg>
There. You should now be able to upload your SVG file into wordpress without any rude objections.