WordPress.org

Make WordPress Core

Ticket #13220: highlight_home_link.3.diff

File highlight_home_link.3.diff, 699 bytes (added by ptahdunbar, 8 years ago)
  • wp-includes/nav-menu-template.php

     
    7575                if ( 'custom' != $item->object )
    7676                        $classes[] = 'menu-item-object-'. $item->object;
    7777
    78                 if ( $item->object_id == $wp_query->get_queried_object_id() )
     78                $home_url = esc_url( $_SERVER['HTTP_HOST'] ) . esc_url( $_SERVER['REQUEST_URI'] );
     79
     80                if ( $item->object_id == $wp_query->get_queried_object_id() || ( 'custom' == $item->object && $item->url == $home_url ) )
    7981                        $classes[] = 'current-menu-item';
    8082
    8183                // @todo add classes for parent/child relationships