How do I use inline SVG in WordPress

I am trying to put in an SVG inside my post, but it seems WordPress removes the content.

e.g.

 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="190">
 <polygon points="100,10 40,180 190,60 10,60 160,180"
 style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;">
 </svg>

Gets rendered to

 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="190"></svg>

Is it possible to do this without a plugin like raw_plugin

1 Answer
1

According to this post, if you put all the svg block in one line, it will be rendered.

This should work:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="190"> <polygon points="100,10 40,180 190,60 10,60 160,180" style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;"> </svg>

Leave a Comment