Support » Plugin: Safe SVG » Insert inline svg code?

  • Resolved ginaginagina


    I created an svg image using code on’s svg generator. I have the svg code, but it’s not a file, it’s just straight up markup. I downloaded your plugin, but it didn’t allow me to see the svg image (which I inserted in the text editor in a specific area of a post). I need it to be markup because I have to include a dynamic shortcode in the middle of the svg image (the image is a membership card that is dynamically updated with a date shortcode).

    Is it possible to do this with your plugin? Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daryll Doyle


    Hi @ginaginagina,

    Unfortunately, that isn’t something this plugin will help with. This plugin is mainly for sanitising SVG files on upload, any fixes to the admin area are purely there to make life a bit easier for the user.

    That said, if you’re pasting your SVG markup into the html section of the editor, when you switch back to visual, I see no reason that the editor shouldn’t convert it for you.

    I’m sorry I can’t be much more help.




    Oh, shoot! 🙁 Yeah, apparently, WP won’t insert raw svg code, at least from what I’ve been reading online. (Would be super happy to be wrong!) I would upload the SVG as a file, but I don’t know how; especially because I need to have one line of it be dynamic (update the month/year within the graphic). I guess I have more learning to do!

    Thank you. 🙂



    Hey, I actually just got done implementing this for my own site. Here is a gist for a WordPress filter that will replace svg-img tags with the inline SVG code from the sourced file when the page loads. It’s coded to only work on locally-hosted SVG files stored in your WordPress content folder and it runs the code through @enshrined‘s svg-sanitizer library (which must be installed) just in case the SVG got uploaded to the site by some means that avoids this plugin (an integrated forum’s posts, for example).

    To use this, paste the entire code into your theme’s functions.php or get a plugin like code snippets and add it as a snippet to that.

    • This reply was modified 11 months ago by  jadeddragoon. Reason: forgot the link, derp
    • This reply was modified 11 months ago by  jadeddragoon.
    • This reply was modified 11 months ago by  jadeddragoon.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Insert inline svg code?’ is closed to new replies.