diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index 5af6be16d39a2b..8671a130fb038b 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -142,7 +142,7 @@ function block_core_gallery_render( $attributes, $content ) { // This pattern matches figure elements with the `wp-block-image` class to // avoid the gallery's wrapping `figure` element and extract images only. - $pattern = '/]*\bwp-block-image\b[^>]*>.*?<\/figure>/'; + $pattern = '/]*\bwp-block-image\b[^>]*>.*?<\/figure>/s'; // Find all Image blocks. preg_match_all( $pattern, $updated_content, $matches );