[wp-trac] [WordPress Trac] #13371: Nav menu items should be filterable, regardless of context

WordPress Trac wp-trac at lists.automattic.com
Thu May 13 03:35:27 UTC 2010


#13371: Nav menu items should be filterable, regardless of context
--------------------------+-------------------------------------------------
 Reporter:  nathanrice    |       Owner:                             
     Type:  defect (bug)  |      Status:  new                        
 Priority:  normal        |   Milestone:  3.0                        
Component:  Menus         |     Version:  3.0                        
 Severity:  normal        |    Keywords:  menus, nav menus, has-patch
--------------------------+-------------------------------------------------
 It's kind of weird that in order for a plugin/theme to filter the nav menu
 items, the $args->context needs to be 'frontend'.

 For example, since the $args object is passed through the
 wp_nav_menu_items filter, the user-defined filter can do the contextual
 checks. For instance ...

 {{{
 add_filter('wp_nav_menu_items', 'my_nav_menu_items_filter', 10, 2);
 function my_nav_menu_items_filter($items, $args) {
     if( $args->context != 'frontend' )
         return $items;

     // proceed with the filter
 }
 }}}

 Plus, I can see plenty of reasons why a plugin/theme might want to filter
 the items regardless of context.

 Either way, it should be up to the plugin/theme author, shouldn't it?

 I've attached a patch.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13371>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list