Discover how to detect easily which images in your WordPress installation do not have the ALT attribute, without plugins.
The ALT attribute of images is very important as it is used by screen readers and search engines to understand the content of the image.
But many times it remains empty, either by an oversight or lack of habit to fill this attribute.
If you want to improve the accessibility of your website and also for search engines to understand your images better, it is worth filling in this field.
In this tutorial I will show you a very simple trick so that you can easily and visually detect which images are missing the ALT attribute. This would be the result:
Let’s see:
Snippet to detect images without ALT attribute in WordPress
If you want images that lack ALT attributes to stand out as in the example above, insert this code at the end of the style.css file:
To see this and another 1097 code snippets of this website, login or subscribe here.
With this fragment you add a red dashed border to images that do not have the ALT attribute defined.
In addition, you apply it only to logged-in users so that visitors to your website do not see it. This is ideal for administrators, authors or editors in order to detect and correct them.
However, I don’t recommend you to use it in memberships sites (or similar) since subscribers will also see it… unless you want to offer a reward to those who “hunt” images without ALT. 😉
Conclusions
As you can see, tis is very easy to mark and detect images without ALT attribute in WordPress with a little CSS.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉