core/gallery get figcaption text

You’re right…the figcaptions are encoded as html in $block['innerHTML']. You could do sth. like $tmpArray = explode('</li>',$block['innerHTML']); before your foreach loop to split the HTML string into an array that matches your gallery items and inside the loop strip_tags($tmpArray[i]); to strip away all html tags and only get the text string inside <figcaption></figcaption>. You’ll only need to add a counter i to your loop to have an index for the $tmpArray.

tech