Title: Insert inline svg code?
Last modified: July 11, 2018

---

# Insert inline svg code?

 *  Resolved [ginaginagina](https://wordpress.org/support/users/ginaginagina/)
 * (@ginaginagina)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/insert-inline-svg-code/)
 * I created an svg image using code on w3schools.org’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 Contributor [Daryll Doyle](https://wordpress.org/support/users/enshrined/)
 * (@enshrined)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/insert-inline-svg-code/#post-10487500)
 * Hi [@ginaginagina](https://wordpress.org/support/users/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.
 * Cheers,
    Daryll
 *  Thread Starter [ginaginagina](https://wordpress.org/support/users/ginaginagina/)
 * (@ginaginagina)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/insert-inline-svg-code/#post-10488519)
 * 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. 🙂
    -  This reply was modified 7 years, 10 months ago by [ginaginagina](https://wordpress.org/support/users/ginaginagina/).
 *  [jadeddragoon](https://wordpress.org/support/users/jadeddragoon/)
 * (@jadeddragoon)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/insert-inline-svg-code/#post-10597275)
 * Hey, I actually just got done implementing this for my own site. Here is [a gist](https://gist.github.com/JadedDragoon/72866424f26828111e0b8574597f78f3)
   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](https://wordpress.org/support/users/enshrined/)’s svg-sanitizer
   library (which must be [installed](https://github.com/darylldoyle/svg-sanitizer#installation))
   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](https://wordpress.org/plugins/code-snippets/) and add it
   as a snippet to that.
    -  This reply was modified 7 years, 9 months ago by [jadeddragoon](https://wordpress.org/support/users/jadeddragoon/).
      Reason: forgot the link, derp
    -  This reply was modified 7 years, 9 months ago by [jadeddragoon](https://wordpress.org/support/users/jadeddragoon/).
    -  This reply was modified 7 years, 9 months ago by [jadeddragoon](https://wordpress.org/support/users/jadeddragoon/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Insert inline svg code?’ is closed to new replies.

 * ![](https://ps.w.org/safe-svg/assets/icon.svg?rev=2779013)
 * [Safe SVG](https://wordpress.org/plugins/safe-svg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/safe-svg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/safe-svg/)
 * [Active Topics](https://wordpress.org/support/plugin/safe-svg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/safe-svg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/safe-svg/reviews/)

## Tags

 * [svg](https://wordpress.org/support/topic-tag/svg/)

 * 3 replies
 * 3 participants
 * Last reply from: [jadeddragoon](https://wordpress.org/support/users/jadeddragoon/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/insert-inline-svg-code/#post-10597275)
 * Status: resolved