Skip to content

Commit

Permalink
Expose serialized template content on WP_Block_Template.
Browse files Browse the repository at this point in the history
When building the template, initialize WP_Block_Template with the serialized block content so callbacks registered to the `hooked_block_types` filter can access the content.
  • Loading branch information
nerrad authored Nov 10, 2023
1 parent 9df9e28 commit 6c43311
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ function _build_block_template_result_from_file( $template_file, $template_type
$template->has_theme_file = true;
$template->is_custom = true;
$template->modified = null;
$template->content = $template_content;

if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) {
$template->description = $default_template_types[ $template_file['slug'] ]['description'];
Expand Down

0 comments on commit 6c43311

Please sign in to comment.