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. ! 😀
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0