diff --git a/packages/block-library/src/navigation-submenu/index.php b/packages/block-library/src/navigation-submenu/index.php index 6ff4899575b272..f48254824e5cc1 100644 --- a/packages/block-library/src/navigation-submenu/index.php +++ b/packages/block-library/src/navigation-submenu/index.php @@ -148,7 +148,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { $css_classes = trim( implode( ' ', $classes ) ); $has_submenu = count( $block->inner_blocks ) > 0; - $is_active = ! empty( $attributes['id'] ) && ( get_the_ID() === (int) $attributes['id'] ); + $is_active = ! empty( $attributes['id'] ) && ( get_queried_object_id() === (int) $attributes['id'] ); $show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon']; $open_on_click = isset( $block->context['openSubmenusOnClick'] ) && $block->context['openSubmenusOnClick']; diff --git a/packages/block-library/src/page-list/index.php b/packages/block-library/src/page-list/index.php index 89a8ea1b071be3..af2e89587e0f21 100644 --- a/packages/block-library/src/page-list/index.php +++ b/packages/block-library/src/page-list/index.php @@ -264,7 +264,7 @@ function render_block_core_page_list( $attributes, $content, $block ) { $active_page_ancestor_ids = array(); foreach ( (array) $all_pages as $page ) { - $is_active = ! empty( $page->ID ) && ( get_the_ID() === $page->ID ); + $is_active = ! empty( $page->ID ) && ( get_queried_object_id() === $page->ID ); if ( $is_active ) { $active_page_ancestor_ids = get_post_ancestors( $page->ID );