Tools
The trick to detect images without ALT attribute in WordPress
A code snippet with Code Snippets highlights in red the images without
1 min read
Why is the ALT attribute important?
The ALT attribute is the text that describes an image. It plays a crucial role in web accessibility: it allows people with visual disabilities to understand the content of images. Search engines use it to index and rank them, and this directly affects SEO positioning (how your site appears in searches).
The trick to detect images without ALT attribute in WordPress
To highlight images that don't have the ALT attribute, you can add a code snippet using Code Snippets (a plugin that adds pieces of code to WordPress without touching the theme), as I explained in How to remove items from the WordPress administration menu with Code Snippets. The code adds a red dashed border to images without a defined ALT: at a glance you see which ones are missing.
Implementing the CSS code
Implementing the CSS code (the language that defines the appearance of a page) is simple. It only applies to users with the administrator role, so they can detect and correct images without the ALT attribute.