Add alt tag info to the image block?

it would be great if you could add alt tag image info to the image block capability. i can’t go live without the site being accessible.


Didn’t test it, but shouldn’t that work this way?

Ok couldn’t resist so i tested it. It worked for me!

Bildschirmfoto 2022-08-03 um 08.32.54

1 Like

Well great maybe I just learned something. let me test.

Does it pull the alt tag from image in the media library or did you have to enter it on the post?

That one I’ve posted is just a simple input field where you get an option to enter the alt text

@matjaz maybe you can let me know how to pull in the alt tag from an image in the media library. Using acf is so clunky in blocks. PG has made things so much easier.

@smgitner it is not possible at the moment. We have it (pulling the alt from the image media info) on the to-do list for the next release.


Pulling the alt tag from the media library is great as a default action, but I hope you leave the ability to specify the alt text manually. There are a lot of cases when I want to dynamically populate the alt text, when I want to reuse the image on another page with different alt text, or when I need to translate the alt text. None of those work when it is pulled from the media library.

@adamslowe yes, it will be optional.

1 Like

Thank you. I can’t go live without alt tags. My company has very stringent accessibility requirements and Alt tags are very important to being compliant. The default settings add will be very very helpful.

@smgitner I would give consideration to changing the way you handle alt text, given your accessibility requirements and the jankiness of the WP Media Library. In addition to the issues I raised above, any alt text added to an image in the library after it’s been added to a page will not re-populate the alt text on the page.

Understood. I run a student journalism website I have any where from 50 to 100 students on the site through a semester. I can’t be having them change things on the fly. I need the media library to be the go to place for all things media. We actually have a workflow where photojournalists add alt tags into the IPTC of images in photo mechanic just like AP would do for the wire. So @Matjaz at Pinegrow it would be great if you could pull caption info description etc. from the images into a block along with alt tag info. That would be a game changer for news entities. This way we could make galleries from basketball and football games and be compliant.

The current site uses acf flexible fields check it out I am changing it over to blocks using PG.

Btw I love the tutorials!! Keep them coming!

@smgitner Ahh… I think I misunderstood your initial post, thinking that you are talking about alt text rather than IPTC tags (keywords?). Or, do you treat the tags as the alt text? I was always under the impression that IPTC keywords were meant for organizational and retrieval and that the IPTC description field was more appropriate for Alt Text, per the WCAG.

I’ve never used IPTC tags outside of my DAM, but it would be an interesting exercise to find a way to populate the alt text attribute directly from the images.

Also, Photo Mechanic was my (not so) secret weapon when I had my photo/video studio. Shhh… don’t tell too many people about it :slight_smile:

@smgitner dynamic PHP blocks are well suited for this use-case because up-to-date ALT, title, caption and other info can be fetched and displayed with PHP WP actions.

The next PG update will contain features that make this easier:

  • New Attachment ALT, Title, Caption and Description actions
  • Ability to use @block:image as the parameter for these actions, so that they reference the image block attribute.

Here is a teaser:


I guess I could do that but then would Ihave to add a separate block for the byline and caption if I want my user to change the content on the page and not in the sidebar? the JS blocks are so intuitive. To be able to change as much stuff literally in the FSE is why I am using Pinegrow and what makes it such a gamechanger. I have some PHP blocks loading but I try to avoid it.

@smgitner yes, JS blocks are nicer, will see what we can do.

A couple of questions:

  • Do you display image caption as it is stored with the image, or do you customize it for each post?
  • As mentioned by @adamslowe, displaying updated image info requires post that contains the info to be re-saved. Don’t you ever change the info after images are used on a post?

Well thank you for asking. It’s beyond rare to be able to interact with the developer of a piece of software.

Yea there’s a couple of ways to go about it. But having the ability to pull the caption info can really cut down on time when you have a gallery of many images.

I do not change the caption in the image when it comes to being in a gallery I like to pull the iptc. The copy editor would actually edit the caption info itself in the media library

If I need to use the image twice we would reupload the image. That way we don’t mess with what has already been done in the iptc.

Being able to pull the credit is important too.

To be honest in my layouts I actually have students write captions that aren’t the same as what is in the media library that way editors can add more information to a story.

So I guess it’s really centered around pulling for galleries.


The latest PG Live 6.7.2 addresses the issues mentioned in this topic. See details below and please report any issues into their respective forum topics. Note, these features are considered Beta for now.

Additional info: image properties such as author, title, etc can now be used in regular JS blocks.

Here is an example:

1 Like