Support » Accessibility » No alt text for image links

  • On attachment and gallery pages, if you have an image that has not been provided with alternate text, it is still the only content of a link, which means the link has no accessible name. This is an accessibility error. Has anyone written a filter for the_content for this use case, where, when no alt text has been provided, some placeholder text is provided, such as, “no text alternative provided.” This filter should only be used in instances where the image serves as the content for a link. For instance, there are places where you would want to have a null alt attribute used instead, as when the image is displayed in a purely decorative context that is not the content of a link.

    • This topic was modified 5 months, 2 weeks ago by  Rob Fentress.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Rupok

    (@re_enter_rupok)

    Hi there,

    You can get idea from some plugin like this – https://wordpress.org/plugins/seo-image/

    Cheers!

    Moderator Andrew Nevins

    (@anevins)

    I’m not sure you can look at those sorts of plugins. As rfentres says, some images are decorative and do not need values in the ‘alt’ attribute. You need to provide different ‘alt’ values for different scenarios.
    The scenarios are:

    1. Decorative images
    2. Images that contain information
    3. Images used as part of links

    So the alt text would need to change in each scenario:

    1. Decorative images: Empty alt text
    2. Images that contain information: Alt text that describes the image
    3. Images used as part of links: Alt text that describes the link destination

    Thanks, Rupok, for the link. That does indeed give me an idea of how I might approach this. Now I just need the time to work on it! 😉

    Andrew, you have correctly enumerated the issues. It would be nice if a solution were integrated into WordPress natively.

    Best,
    Rob

    @rfentres Thanks for pointing this out! I’ll take a look at this and try and get it patched.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.