[wp-trac] [WordPress Trac] #13694: Add $args parameter to wp_create_nav_menu()

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 2 17:27:57 UTC 2010


#13694: Add $args parameter to wp_create_nav_menu()
--------------------------+-------------------------------------------------
 Reporter:  mikeschinkel  |       Owner:                        
     Type:  enhancement   |      Status:  new                   
 Priority:  normal        |   Milestone:  3.0                   
Component:  Menus         |     Version:  3.0                   
 Severity:  normal        |    Keywords:  has-patch dev-feedback
--------------------------+-------------------------------------------------

Comment(by mikeschinkel):

 Spoke a tiny bit too soon.

 While I can definitely accomplish what I need with this it seems like it
 will be rather inefficient for a large number of menus.  Not sure if
 there's a better way or not, but my `list_terms_exclusions` was more
 efficient with larger datasets albeit breaking encapsulation. My use case
 here is to have a large number of menus and always filter almost everyone
 out.

 Thoughts?

 {{{
 add_filter('wp_get_nav_menus','microsite_get_nav_menus');
 function microsite_get_nav_menus($menus) {
         if ($GLOBALS['PHP_SELF']!='/wp-admin/nav-menus.php') {
                 $new_menus = $menus;
         } else {
                 $new_menus = array();
                 foreach($menus as $menu)
                         if (substr($menu->slug,0,15)!='microsite-menu-')
                                 $new_menus[] = $menu;
         }
         return $new_menus;
 }
 }}}

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


More information about the wp-trac mailing list