WordPress: Find images without alt text
WordPress always adds an alt attribute to images added via the Media Library so finding images without alternative text is easy!
- Get posts of all Post Types
- Only get Published, Privately Published & Draft posts
- Look for the presence of an
imgtag with an empty value foralt
The SQL
[sql]
SELECT * FROM wp_posts
WHERE post_status IN (‘publish’, ‘draft’, ‘private’)
AND post_content LIKE ‘%<img%alt=""%’
[/sql]