Support

Account

Home Forums ACF PRO Image field with both alt description and src set

Helping

Image field with both alt description and src set

  • Hello all,
    image fields in ACF can return the image ID, which generates the src set attribute, or the image Object, which provides the alt text.

    I want to use both the src set *and* the alt text for my images.
    I tried adding the alt attribute to wp_get_attachment_image like so: echo wp_get_attachment_image($image, $size, $attr = 'alt');
    but that does not work.

    Question: how can I output both the scr set and the alt text?
    Thanks!

  • wp_get_attachment_image() adds the image alt automatically if it the image has that value set.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.