Wordpress is stripping the Alt tag's quote marks from images where Alt is not set, but leaving the word 'alt' creating problems for ADA compliance
-
26-04-2021 - |
سؤال
How do I get around this? For ADA compliance I specifically need alt=""
on some of my images in a wordpress site, however wordpress is stripping the Alt tag's quote marks from images where Alt is not set, and just leaving the word 'alt' without the quotation marks. How do I make sure the Alt tags are left intact with their quote marks? I just need it to say alt=""
instead of alt
. ! :D
المحلول
I tried to replicate your issue and while the dev tools show it as alt
the source code shows alt=""
, so WordPress is not stripping the quotes, it's just the dev tools being concise. But even if it was, they're equivalent so alt
and alt=""
are the same.
As for why the dev tools display alt
, it's because the dev tools don't display the HTML, they display the DOM