diff --git a/packages/block-library/src/home-link/index.php b/packages/block-library/src/home-link/index.php index 39b1d5271c06cb..8fb5ed109019d3 100644 --- a/packages/block-library/src/home-link/index.php +++ b/packages/block-library/src/home-link/index.php @@ -100,14 +100,10 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) { ); $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] ); $classes[] = 'wp-block-navigation-item'; - // The ID of the static page assigned to the blog posts index (posts page). String, '0' if not set. - $page_for_posts = get_option( 'page_for_posts' ); - // The ID of the current page. - $page_id = get_queried_object_id(); if ( is_front_page() ) { $classes[] = 'current-menu-item'; - } elseif ( is_home() && ( (int) $page_for_posts !== $page_id ) ) { + } elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) { // Edge case where the Reading settings has a posts page set but not a static homepage. $classes[] = 'current-menu-item'; } @@ -136,14 +132,10 @@ function render_block_core_home_link( $attributes, $content, $block ) { return ''; } $aria_current = ''; - // The ID of the static page assigned to the blog posts index (posts page). String, '0' if not set. - $page_for_posts = get_option( 'page_for_posts' ); - // The ID of the current page. - $page_id = get_queried_object_id(); if ( is_front_page() ) { $aria_current = ' aria-current="page"'; - } elseif ( is_home() && ( (int) $page_for_posts !== $page_id ) ) { + } elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) { // Edge case where the Reading settings has a posts page set but not a static homepage. $aria_current = ' aria-current="page"'; }