From d8fc1a3b62df048cfaab00c0d4cc0e6b25dc79b2 Mon Sep 17 00:00:00 2001 From: Ricardo Artemio Morales Date: Thu, 1 Jun 2023 10:04:02 +0200 Subject: [PATCH] Improve syntax --- packages/block-library/src/image/index.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index ac89aefa6a741..8b5b554b825da 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -60,11 +60,7 @@ function render_block_core_image( $attributes, $content ) { $content = $processor->get_updated_html(); $w = new WP_HTML_Tag_Processor( $content ); - $w->next_tag( - array( - 'tag_name' => 'figure', - ) - ); + $w->next_tag( 'figure' ); $w->add_class( 'wp-lightbox-container' ); $w->set_attribute( 'data-wp-interactive', '' ); $w->set_attribute( 'data-wp-context', '{ "core": { "image": { "initialized": false, "lightboxEnabled": false } } }' ); @@ -106,7 +102,7 @@ function render_block_core_image( $attributes, $content ) { HTML; - return preg_replace( '/<\/figure>/', $lightbox_html . '', $body_content ); + return str_replace( '', $lightbox_html . '', $body_content ); } return $processor->get_updated_html();