Skip to main content
Home / Articles /

SVG Uploads in WordPress (the Inconvenient Truth)

Direct Link →

Bjørn Johansen covers why:

  1. It's easy to enable SVG uploads in WordPress (few lines to a functions.php file or functionality plugin)
  2. It makes sense why WordPress doesn't allow them by default.

Jake Archibald in the comments:

In hindsight there probably should have been two content types, one that treats SVG has a full document context, and the other as a simple image (how browsers treat SVG in today, which cannot execute script or initiate fetches).

Hear hear.

I also had someone tell me: "I'd buy your new book, but WordPress doesn't allow SVG, and I work in WordPress." To which I'd say, it's only the media uploader that disallows them, and as the article covers, it's easy to enable them (as long as you're aware of the risks). But you can use SVG to your heart's content as part of the theme.

icon-link icon-logo-star icon-search icon-star