Make WordPress Core

Ticket #35702: wp_35702.diff

File wp_35702.diff, 933 bytes (added by dotancohen, 10 years ago)

Diff file which resolves the issue for a common use case.

  • wp-includes/nav-menu-template.php

    diff --git a/public_html/wp-includes/nav-menu-template.php b/public_html/wp-includes/nav-menu-template.php
    index e947eb8..62a7f27 100644
    a b function _wp_menu_item_classes_by_context( &$menu_items ) { 
    542542                $classes[] = 'menu-item-type-' . $menu_item->type;
    543543                $classes[] = 'menu-item-object-' . $menu_item->object;
    544544
     545                // If the menu item URL corresponds to the currently-queried object's slug
     546                if ( trim($menu_item->url,'/') == trim($wp_query->queried_object->rewrite['slug'],'/') ) {
     547                        $classes[] = 'current-menu-item';
     548                }
     549
    545550                // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object
    546551                if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) {
    547552                        $active_parent_object_ids[] = (int) $menu_item->object_id;