[wp-trac] [WordPress Trac] #13976: wp_nav_menu() uses IDs for menu-items preventing re-use on the same page

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 18 15:00:08 UTC 2010


#13976: wp_nav_menu() uses IDs for menu-items preventing re-use on the same page
--------------------------+-------------------------------------------------
 Reporter:  foolsrun      |       Owner:                                   
     Type:  defect (bug)  |      Status:  new                              
 Priority:  normal        |   Milestone:  3.0.1                            
Component:  Menus         |     Version:  3.0                              
 Severity:  normal        |    Keywords:  menu id css wp_nav_menu has-patch
--------------------------+-------------------------------------------------

Comment(by filosofo):

 What I'm saying is that this scenario--printing the same menu twice on one
 page--is unusual enough that we shouldn't try to handle it in core, but
 the attached patch makes it so someone who wants to can make unique IDs in
 just a few lines of code.

 I concede that it might be better just to get rid of the id attribute
 altogether, but there's precedent for including them in the page- and
 category-listing functions.

 If you really don't like it currently, pass your own Walker class to
 `wp_nav_menu`, or use regex to filter out the id attributes at one of the
 several filters the markup goes through before being printed.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13976#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list