[wp-trac] [WordPress Trac] #23902: Classes set with nav_menu_css_class are not accessible in walker_nav_menu_start_el

WordPress Trac noreply at wordpress.org
Mon Feb 24 16:57:40 UTC 2014


#23902: Classes set with nav_menu_css_class are not accessible in
walker_nav_menu_start_el
-------------------------------+------------------------------
 Reporter:  jamesmehorter      |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Menus              |     Version:  3.5.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by jamesmehorter):

 Use case:

 I needed to add a little <div></div> inside menu <li>'s with the classes
 current-page-ancestor or current_page_parent.

 If I added either of those classes manually via nav_menu_css_class, I was
 then unable to access those classes in the later-run
 walker_nav_menu_start_el hook to add the html.

 (When using a page as a CPT ancestor you have to manually add the classes
 as mentioned above)

 @ericlewis - regardless of use, a later-run hook should always have the
 most current object-whatever it is. Given that nav_menu_css_class runs
 before walker_nav_menu_start_el - any change made to the menu via
 nav_menu_css_class should be accessible in any later hook.

 Does that help?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23902#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list