diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php index 87ad50634c108..bc69c153d736d 100644 --- a/src/wp-includes/block-template-utils.php +++ b/src/wp-includes/block-template-utils.php @@ -475,12 +475,19 @@ function _flatten_blocks( &$blocks ) { * stylesheet as a theme attribute into each wp_template_part * * @since 5.9.0 + * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) instead. * @access private * * @param string $template_content serialized wp_template content. * @return string Updated 'wp_template' content. */ function _inject_theme_attribute_in_block_template_content( $template_content ) { + _deprecated_function( + __FUNCTION__, + '6.4.0', + 'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_inject_theme_attribute_in_template_part_block" )' + ); + $has_updated_content = false; $new_content = ''; $template_blocks = parse_blocks( $template_content ); diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php index e7ee300062b3e..e5d4a7cdc8cd3 100644 --- a/tests/phpunit/tests/block-template-utils.php +++ b/tests/phpunit/tests/block-template-utils.php @@ -311,6 +311,13 @@ public function test_not_inject_theme_attribute_non_template_part_block() { ); } + /** + * @ticket 59452 + * + * @covers ::_inject_theme_attribute_in_block_template_content + * + * @expectedDeprecated _inject_theme_attribute_in_block_template_content + */ public function test_inject_theme_attribute_in_block_template_content() { $theme = get_stylesheet(); $content_without_theme_attribute = '';