diff --git a/packages/block-library/src/gallery/save.js b/packages/block-library/src/gallery/save.js index 11feb8412b249..a77a0761cb83e 100644 --- a/packages/block-library/src/gallery/save.js +++ b/packages/block-library/src/gallery/save.js @@ -41,6 +41,10 @@ export default function save( { attributes } ) { break; } + // image.caption comes from a RichText component, so it can contain + // HTML that we need to strip. In GB 9.2, image.alt would fall back to + // image.caption without stripping the HTML, so we also run it through + // __unstableStripHTML here. let alt = image.alt || image.caption; if ( alt && alt !== __unstableStripHTML( alt ) ) {