diff --git src/wp-includes/nav-menu-template.php src/wp-includes/nav-menu-template.php
index 8895476..36cc8f4 100644
|
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
431 | 431 | $classes[] = 'menu-item-home'; |
432 | 432 | } |
433 | 433 | |
| 434 | // Get an array of all public custom post types. |
| 435 | $post_types = get_post_types( array( |
| 436 | 'public' => true, |
| 437 | '_builtin' => false |
| 438 | ) ); |
| 439 | |
| 440 | // Check if a custom post type single item is being viewed. |
| 441 | if ( is_singular( $post_types ) ) { |
| 442 | |
| 443 | // Get the post type being viewed. |
| 444 | $post_type = get_post_type(); |
| 445 | |
| 446 | if ( $post_type === $menu_item->object ) { |
| 447 | $classes[] = 'current_page_parent'; |
| 448 | } |
| 449 | } |
| 450 | |
434 | 451 | // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query |
435 | 452 | if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) |
436 | 453 | $classes[] = 'current_page_parent'; |