• I have added inline svg code you my WooComemrce product specificiations teb. When I save this shows fine. But if I open the product details again and view the details all the SVG code is gone.
    If any changes to the product such as simple changing the price and saving then all the SVG code is removed.
    The SVG code is used for the Controls icons.
    How can I prevent WordPress and WooComemrce from stripping this code?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Benbodhi

    (@benbodhi)

    Hi there,

    I think you’d need to write a custom plugin to filter the product content. SVG code saving in admin like that could introduce extra security risk, so they’d be stripping it by default to avoid any XML injection.

    Unfortunately my plugin doesn’t handle that aspect.

    Possible workaround:
    You may be able to use an img like my plugin explains. I haven’t tried in product descriptions tbh. But you’d just add an SVG image like this in text mode:
    <img style="style-svg" src="your-svg-file-URL.svg" />

    If you have my plugin’s advanced settings active, this should swap out the img tag with your inline svg. It doesn’t need to be parsed by the content as svg code then.

    Hope this helps!
    Let me know how you go.

    Plugin Author Benbodhi

    (@benbodhi)

    I’ll mark this as resolved for now, but please do let me know if you need any further help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stop line SVG code stripping’ is closed to new replies.