I use little inline SVG rectangles to help website editors see and choose brand colors…
In Radio field labels (with an option such as primary : primary <svg class=”clone-color-bar”><rect fill=”#1F72B1″></rect></svg>):
In a Message field in the sidebar so they can quickly see their brand color names and hex value (entered like <svg class=”clone-color-bar”><rect fill=”#1f72b1″></rect></svg> primary #1f72b1):
But after upgrading to ACF 5.10.2 my SVGs are being stripped:
I read through the changelog and see updates have been made to escape HTML and I wonder if this is related? Is there any way to have my inline SVG appear again? I tried replicating what I need with <div>s instead of <svg> but it seems the style attribute is stripped from those as well which would make it harder to define a background color quickly (which may be there reason I’m using inline SVG at all, I’ve been using this method on sites for a few years and forget the exact reason)
Using Classic Editor plugin, btw, though I disabled it and saw the same issue with the block editor.
Specifically, at the bottom of that article you can see our code snippet you’ll need to add to your theme or plugin in order to allow SVGs inside your markup, as WordPress does not allow them by default.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users