[wp-trac] [WordPress Trac] #39800: current_item_{parent|ancestor} Not set for Post Type Archive Items

WordPress Trac noreply at wordpress.org
Mon Feb 6 18:42:20 UTC 2017


#39800: current_item_{parent|ancestor} Not set for Post Type Archive Items
--------------------------+-----------------------------
 Reporter:  mrwweb        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  4.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 '''To reproduce:'''

 Add a Post Type Archive link as a submenu item.

 '''Expected Result:'''

 Parent `$item` object in menu should have `$item->current_item_parent` as
 `true`.

 '''Current Result:''

 `var_dump` of the parent menu's `$item` in the
 `Walker_Nav_Menu->start_el()` shows `current_item_parent` as `false`.

 Interestingly, `$item->menu_item_parent` of the current menu item (the
 post type archive) is set to the correct menu item object ID.

 ---------

 Note, in the past there have been quite a few reports of the Post Type
 Archive link and it's parents not receiving the correct CSS classes. This
 has been fixed, but I wonder if the fix was only a bandaid and missed the
 underlying issue. I'll keep investigating and report back if I can figure
 out a potential solution.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39800>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list