1

I want to insert svg code in a Guttenberg HTML block. I don't want it as an image because I want to manipulate it with CSS. If I insert svg, all tag diseappears and I have only the text which was inside svg tags. Thanks.

1 Answer 1

1

I tried this code on a clean install of WordPress

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>

and used 'Custom HTML' in Guttenberg in a new post. This worked fine for me.

The same code displayed in the DOM without deleting any tags or adding any

Maybe you cant edit the SVG with HTML because WordpPress doesn't generate the code until the page is called.

1
  • That's strange, it doesn't work for me. Even your code is stripped...
    – Alysko
    Oct 20, 2019 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.