- This topic has 9 replies, 2 voices, and was last updated 3 years, 9 months ago by David.
-
AuthorPosts
-
July 2, 2020 at 3:27 am #1349192Olivier
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.
July 2, 2020 at 5:14 am #1349292DavidStaffCustomer SupportHi 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?July 2, 2020 at 5:28 am #1349314OlivierExample 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>
July 2, 2020 at 5:46 am #1349333DavidStaffCustomer SupportThat code is perfectly fine – just tested it in a Hook element and a HTML Block and both work.
Are you using any security plugins ?
July 2, 2020 at 5:54 am #1349343OlivierSecuPress 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?
July 2, 2020 at 6:53 am #1349400DavidStaffCustomer SupportI 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?
July 2, 2020 at 9:34 am #1349713OlivierFor 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!
July 2, 2020 at 9:48 am #1349726DavidStaffCustomer SupportVery 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/
July 2, 2020 at 9:59 am #1349737OlivierAh yes, it works perfectly, great! Thanks David 🙂
July 2, 2020 at 10:01 am #1349742DavidStaffCustomer SupportGreat to hear that!
-
AuthorPosts
- You must be logged in to reply to this topic.