Prevent image title from being inserted as alt text if alt is left blank
-
I’m having the following issue:
- I upload an image to WP using Add Media
- I ensure there is text in the Title field (autofilled based on file name
- I intentionally leave the ‘Alt Text’ field blank (for example, on a purely decorative image, as per WCAG 2.0 guidelines)
- When I view the source of what is inserted into the page, alt is set to the image title, not blank as desired
Having the title autofill the alt tag poses several issues from an accessibility standpoint:
- There is no easy way to set alt text as blank/null via the gui for purely decorative images
- There is no easy way to use a third party tool to scan for images that do not have alt text set
Ideally I would like to override this functionality in a theme or plugin. In a perfect world, there would be a ‘decorative image’ checkbox that would insert
alt=""
, and alt text would become a required field if it was not checked.Any idea how to accomplish any of this? I haven’t found any good techniques for changing how images are inserted.
Many thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Prevent image title from being inserted as alt text if alt is left blank’ is closed to new replies.