diff --git a/packages/block-library/src/navigation-link/index.php b/packages/block-library/src/navigation-link/index.php index d65f65acc56c6..69d61f0e26a16 100644 --- a/packages/block-library/src/navigation-link/index.php +++ b/packages/block-library/src/navigation-link/index.php @@ -150,7 +150,7 @@ function render_block_core_navigation_link( $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'] ); $wrapper_attributes = get_block_wrapper_attributes( array(