From e46ecabba788eeb6022db9c927210bacf8c6b27d Mon Sep 17 00:00:00 2001 From: Jason Crist Date: Mon, 17 May 2021 15:47:21 -0400 Subject: [PATCH] Allow block attributes passed to block renderer by way of wp_nav_menu. --- lib/navigation.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/navigation.php b/lib/navigation.php index b1e7d21b031589..7bfe3416647c6e 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -299,9 +299,14 @@ function gutenberg_output_block_nav_menu( $output, $args ) { $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item; } + $block_attributes = array(); + if ( isset( $args->block_attributes ) ) { + $block_attributes = $args->block_attributes; + } + $navigation_block = array( 'blockName' => 'core/navigation', - 'attrs' => array(), + 'attrs' => $block_attributes, 'innerBlocks' => gutenberg_convert_menu_items_to_blocks( isset( $menu_items_by_parent_id[0] ) ? $menu_items_by_parent_id[0]