[Resolved] Problem svg online deleted

Home Forums Support Problem svg online deleted

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1349192
    Olivier

    Hello,

    I have a problem that I cannot understand, when I want to put an svg icon online whether it is in the container or in a hook, as soon as I click to validate WordPress immediately deletes the <svg> tag.

    Do you have an idea of the problem? I disabled all plugins and tried to import a demo with svg icons but nothing to do. Have you ever had this kind of problem?

    Thank you in advance.

    #1349292
    David
    Staff
    Customer Support

    Hi there,

    if WP is removing it then it believes the code is invalid.
    Can you share an example of the SVG code you’re trying to use?

    #1349314
    Olivier

    Example icon svg html

    <svg aria-hidden="true" role="img" height="1em" width="1em" viewbox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm92.49 313l-20 25a16 16 0 01-22.49 2.5l-67-49.72a40 40 0 01-15-31.23V112a16 16 0 0116-16h32a16 16 0 0116 16v144l58 42.5a16 16 0 012.49 22.5z"></path></svg>

    Example icon svg html Facebook social media follow button

    <a href="https://www.facebook.com/example" class="wpfacebook-social-footer-fb" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                <path d="M12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm3 8h-1.35c-.538 0-.65.221-.65.778v1.222h2l-.209 2h-1.791v7h-3v-7h-2v-2h2v-2.308c0-1.769.931-2.692 3.029-2.692h1.971v3z" /></svg></a>
    #1349333
    David
    Staff
    Customer Support

    That code is perfectly fine – just tested it in a Hook element and a HTML Block and both work.

    Are you using any security plugins ?

    #1349343
    Olivier

    SecuPress but I already tried to deactivate this plugin as well as all the plugins and completely empty the .htaccess file by restoring it to the original too and the problem is still there, I do not understand where this problem of refusal of svg tag can come from. Have you ever had this kind of problem before?

    #1349400
    David
    Staff
    Customer Support

    I have not seen the issue before when the code is valid. However another user today is experiencing a similar problem within the Block Editor.

    Can you test will all other plugins aside from GP Premium to see if there is a conflict somewhere?

    #1349713
    Olivier

    For information, I saw the subject of the other user, for my part the SVG code does not disappear from the field in the block editor but it does not appear on the page, nor in the HTML code.

    And if I insert for example an SVG tag that I sent you earlier via a hook, the SVG tags are immediately deleted as soon as I click on publish.

    I tried to put an SVG tag in a code module on another site without GP Premium and it doesn’t work either, the SVG tags are immediately deleted as soon as I publish …

    I’m drying LoL!

    #1349726
    David
    Staff
    Customer Support

    Very odd – i did find this article, personally never had any issues or need for it… but try the first filter the author provides:

    https://mkaz.blog/wordpress/allowing-svg-in-wordpress-content/

    #1349737
    Olivier

    Ah yes, it works perfectly, great! Thanks David 🙂

    #1349742
    David
    Staff
    Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.