diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php index f71ae26aab..a4e54432d2 100644 --- a/wp-includes/block-template-utils.php +++ b/wp-includes/block-template-utils.php @@ -547,18 +547,15 @@ function _build_block_template_result_from_file( $template_file, $template_type $template->area = $template_file['area']; } - $before_block_visitor = ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ? '_inject_theme_attribute_in_template_part_block' : null; + $before_block_visitor = '_inject_theme_attribute_in_template_part_block'; $after_block_visitor = null; $hooked_blocks = get_hooked_blocks(); if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { $before_block_visitor = make_before_block_visitor( $hooked_blocks, $template ); $after_block_visitor = make_after_block_visitor( $hooked_blocks, $template ); } - if ( null !== $before_block_visitor || null !== $after_block_visitor ) { - $blocks = parse_blocks( $template_content ); - $template_content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); - } - $template->content = $template_content; + $blocks = parse_blocks( $template_content ); + $template->content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); return $template; } diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 3a2e943ad5..ecb4fa5b3d 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -779,9 +779,7 @@ function make_before_block_visitor( $hooked_blocks, $context ) { * @return string The serialized markup for the given block, with the markup for any hooked blocks prepended to it. */ return function ( &$block, $parent_block = null, $prev = null ) use ( $hooked_blocks, $context ) { - if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { - _inject_theme_attribute_in_template_part_block( $block ); - } + _inject_theme_attribute_in_template_part_block( $block ); $markup = ''; diff --git a/wp-includes/class-wp-block-patterns-registry.php b/wp-includes/class-wp-block-patterns-registry.php index 1c528abb3f..a11bac06be 100644 --- a/wp-includes/class-wp-block-patterns-registry.php +++ b/wp-includes/class-wp-block-patterns-registry.php @@ -165,16 +165,14 @@ final class WP_Block_Patterns_Registry { private function prepare_content( $pattern, $hooked_blocks ) { $content = $pattern['content']; - $before_block_visitor = ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ? '_inject_theme_attribute_in_template_part_block' : null; + $before_block_visitor = '_inject_theme_attribute_in_template_part_block'; $after_block_visitor = null; if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { $before_block_visitor = make_before_block_visitor( $hooked_blocks, $pattern ); $after_block_visitor = make_after_block_visitor( $hooked_blocks, $pattern ); } - if ( null !== $before_block_visitor || null !== $after_block_visitor ) { - $blocks = parse_blocks( $content ); - $content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); - } + $blocks = parse_blocks( $content ); + $content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); return $content; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 8da6150478..754583c662 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-beta4-56959'; +$wp_version = '6.4-beta4-56960'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.