Skip to content

Commit 78dc0d4

Browse files
ockhamramonjdaaronrobertshaw
authored andcommitted
Navigation block: Use apply_block_hooks_to_content() (WordPress#65703)
* Navigation block: Use apply-block-hooks-to-content * WPCS Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
1 parent 1c34398 commit 78dc0d4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • packages/block-library/src/navigation

packages/block-library/src/navigation/index.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,15 @@ function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) {
14991499
*/
15001500
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
15011501
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
1502-
$hooked_blocks = get_hooked_blocks();
1503-
$before_block_visitor = null;
1504-
$after_block_visitor = null;
1502+
1503+
if ( function_exists( 'apply_block_hooks_to_content' ) ) {
1504+
$mock_navigation_block_markup = serialize_block( $mock_navigation_block );
1505+
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
1506+
}
1507+
1508+
$hooked_blocks = get_hooked_blocks();
1509+
$before_block_visitor = null;
1510+
$after_block_visitor = null;
15051511

15061512
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
15071513
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );

0 commit comments

Comments
 (0)