Skip Navigation

[Resolved] Image shortcode does not out alt text from media library

This support ticket is created 5 years, 11 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Waqar 5 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1160876

I am trying to: Display an image field from custom post type using alt text entered in the media library. The image shortcode implies that using alt="%%ALT%%" will put the alt text into the result HTML. This is not the case, nor does it even add alt="". This is an issue for accessibility reasons.

I cannot simply use the post title as the alt text because it is not accurate for the purposes of alt text, nor will the same alt text work for multiple images on the same page. I also cannot add any additional code to the functions.php file.

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

I expected to see: Image html with an alt attribute

Instead, I got: Image html without alt attribute

#1161623

Hi there,

Thank you for contacting us and I'll be happy to assist.

I've tested the Type's image field shortcode ( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#image ) on my test website and it generated the "alt" attribute as expected.

Shortcode used:


[types field="employee-image" alt="%%ALT%%" title="%%TITLE%%" size="thumbnail"][/types]

Backend screenshot:
hidden link

Frontend screenshot:
hidden link

Please check if the shortcode was used with alt attribute and the actual image includes the alt text in its media library field.

In case the issue still persists, please test the shortcode again with only Toolset plugins enabled and a default WordPress theme (like Twenty Seventeen), to rule out any code conflict.

I hope this helps and let me know how it goes.

regards,
Waqar

#1161640
image alt 2.png
image alt 3.png
image alt 1.png

I activated the Twenty Seventeen theme and deactivated other plugins (aside from the multisite must-use plugins). The alt attributes still do not show up: hidden link

Here is the template code:

[wpv-post-title]<br><br>
[types field='photo' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional'][/types]<br><br>
[types field='testing-more-photos' title='%%TITLE%%' alt='%%ALT%%' size='medium' resize='proportional' separator=', '][/types]

I've attached photos of the alt text in the media library.

#1162859

Hi there,

Thank you for waiting and for sharing further details.

While I'm still not able to reproduce this behavior of the missing "alt" attribute, I found a similar report, where the same issue was resulted due to incorrect/incomplete site migration from one URL to another.
( https://toolset.com/forums/topic/alt-tag-not-displaying/#post-594618 )

To confirm if your website has the same issue, please upload a new image that hasn't been uploaded to the media library before and then use it with your image field. If it shows the "alt" tag correctly, you'll need to update your website's database to use the correct "guid" values, for the existing image uploads.

regards,
Waqar

#1167773

Hi, I've been out for a few days, but I'll look into this more and report back. Thanks!

#1168404

Thank you and I'll wait for an update.

regards,
Waqar