[wp-trac] [WordPress Trac] #18232: wp_nav_menu - Setting walker parameter affects fallback_cb (was: wp_nav_menu - Setting walker parameter affects fallback_cb (wp_page_menu))

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 25 02:37:06 UTC 2011


#18232: wp_nav_menu - Setting walker parameter affects fallback_cb
-------------------------------------+------------------------------
 Reporter:  bryanjwatson             |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Menus                    |     Version:  3.2.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------------------
Changes (by bryanjwatson):

 * keywords:  has-patch => has-patch needs-testing


Comment:

 Simple patch, but unfortunately it does not account for the scenario when
 a function other than wp_page_menu is set as the fallback_cb parameter.

 For example, this would still break:
 {{{
 <?php wp_nav_menu(array('fallback_cb'=>'wp_list_categories','walker'=>new
 Walker_Nav_Menu)); ?>
 }}}

 I believe the issue resides in the fact that the fallback function is
 inheriting the $args passed to wp_nav_menu.

 Solution: Stop the $args inheritance on the fallback function, and create
 a new wp_nav_menu parameter to provide custom fallback args if needed. See
 patch 18232_v2.

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


More information about the wp-trac mailing list