Skip Navigation

[Resolved] No alt attribute on featured image

This thread is resolved. Here is a description of the problem and solution.

Problem:
The featured image, output with the wpv-post-featured-image shortcode, is missing the alt tag.

Solution:
This is a known issue that only happens when using a custom image size, and will be fixed in the next update.

For a workaround see https://toolset.com/forums/topic/no-alt-attribute-on-featured-image/#post-612215

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by rusty 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#612034

I am trying to: ensure that featured images include an alt attribute.

Link to a page where the issue can be seen: hidden link

I expected to see: In the source for the images, <img src="path/to/image.jpg" alt="alt text here"/>

Instead, I got: No alt attribute.

I've tried using alt="[wpv-post-featured-image output='alt']" to include the alt attribute with the featured image, but just can't seem to make it work. The full code of the image is: [wpv-post-featured-image size="custom" width="640" height="480" crop="true" alt="[wpv-post-featured-image output='alt']"]

I've tried single and double quotes and placing the alt= shortcode in various positions with no change.

#612114

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

This is a known issue which should be fixed in the next stable Views release.

It only happens when you use a custom image size. If you are using one of the standard image sizes the alt tag is included, but, yes, it is omitted when you have a custom image.

I don't have a workaround to offer you, I'm afraid.

#612215

Ok, good to know Nigel.

For a workaround, I just have the featured image shortcode output the URL, then structured my code so I could separate the alt attribute from the shortcode:

<img src="[wpv-post-featured-image output="url" size="custom" width="640" height="480" crop="true"]" alt="[wpv-post-featured-image output='alt']"/>

This is working fine for my situation. Looking forward to the next release. Thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.