diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
index 45d9e47de4..b54d60c061 100644
a
|
b
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
536 | 536 | $classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor'; |
537 | 537 | } |
538 | 538 | |
539 | | if ( in_array( intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) { |
540 | | $classes[] = 'current-menu-ancestor'; |
| 539 | if ( in_array( (int) $parent_item->db_id, $active_ancestor_item_ids ) ) { |
| 540 | $classes[] = 'current-menu-ancestor'; |
| 541 | $classes[] = sprintf( 'current_%s_ancestor', $parent_item->object ); |
541 | 542 | $menu_items[ $key ]->current_item_ancestor = true; |
542 | 543 | } |
543 | 544 | if ( in_array( $parent_item->db_id, $active_parent_item_ids ) ) { |
… |
… |
function _wp_menu_item_classes_by_context( &$menu_items ) { |
548 | 549 | $classes[] = 'current-' . $active_object . '-parent'; |
549 | 550 | } |
550 | 551 | |
551 | | if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) { |
552 | | // Back compat classes for pages to match wp_page_menu() |
553 | | if ( in_array( 'current-menu-parent', $classes ) ) { |
554 | | $classes[] = 'current_page_parent'; |
555 | | } |
556 | | if ( in_array( 'current-menu-ancestor', $classes ) ) { |
557 | | $classes[] = 'current_page_ancestor'; |
558 | | } |
| 552 | // Back compat classes for pages to match wp_page_menu() |
| 553 | if ( 'post_type' === $parent_item->type && 'page' === $parent_item->object && in_array( 'current-menu-parent', $classes ) ) { |
| 554 | $classes[] = 'current_page_parent'; |
559 | 555 | } |
560 | 556 | |
561 | 557 | $menu_items[ $key ]->classes = array_unique( $classes ); |