HTML Img with data:image src gets sanitized in admin?

Question

In the WordPress admin panel (dashboard), I want to add an image inside an ACF field description. Since it’s a simple SVG icon, I want to load it using <img src="data:image/svg+xml..." /> to avoid loading the whole icon font. However, it looks like the HTML is being sanitized or for whatever reason, the icon doesn’t load correctly.

ACF Field:

enter image description here

Image element code:

<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpY29uIGljb24tdGFibGVyIGljb24tdGFibGVyLWNhbGVuZGFyLWV2ZW50IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSI+PC9wYXRoPjxyZWN0IHg9IjQiIHk9IjUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgcng9IjIiPjwvcmVjdD48bGluZSB4MT0iMTYiIHkxPSIzIiB4Mj0iMTYiIHkyPSI3Ij48L2xpbmU+PGxpbmUgeDE9IjgiIHkxPSIzIiB4Mj0iOCIgeTI9IjciPjwvbGluZT48bGluZSB4MT0iNCIgeTE9IjExIiB4Mj0iMjAiIHkyPSIxMSI+PC9saW5lPjxyZWN0IHg9IjgiIHk9IjE1IiB3aWR0aD0iMiIgaGVpZ2h0PSIyIj48L3JlY3Q+PC9zdmc+" />

Result:

enter image description here
enter image description here

As you can see, the data is removed from the img src. If I manually add it again, then the icon appears:
enter image description here
enter image description here

I don’t know if WordPress is doing some kind of sanitization in the background, or it’s done by another plugin, or maybe the ACF itself. How do you think I can solve this?

0
Shahriar 1 month 2022-08-10T11:41:17-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse