Apparently, block hooks are not being applied to templates registered by plugins using the Template registration API.
register_block_template(
'my-plugin//plugin-template',
array(
'title' => 'Test Template',
'description' => 'This is a test template',
'content' => '<!-- wp:separator {className":"is-style-dots"} --><hr class="wp-block-separator has-alpha-channel-opacity is-style-dots"/><!-- /wp:separator -->',
)
);
add_action(
'single_template_hierarchy',
function () {
return array( 'plugin-template' );
}
);
add_filter(
'hooked_block_types',
function ( $hooked_block_types, $relative_position, $anchor_block_type, $context ) {
if ( 'after' === $relative_position && 'core/separator' === $anchor_block_type ) {
$hooked_block_types[] = 'dynamic-copyright-date/copyright-date-block';
}
return $hooked_block_types;
},
10,
4
);
Description
Apparently, block hooks are not being applied to templates registered by plugins using the Template registration API.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.