WordPress.org

Make WordPress Core

Ticket #13694: Adds_$args_param_to_wp_create_nav_menu().diff

File Adds_$args_param_to_wp_create_nav_menu().diff, 911 bytes (added by mikeschinkel, 4 years ago)

Adds an $args parameter for wp_create_nav_menu()

  • trunk/wp-includes/nav-menu.php

     
    143143 * @since 3.0.0 
    144144 * 
    145145 * @param string $menu_name Menu Name 
     146 * @param string $args Optional. 
    146147 * @return mixed Menu object on success|WP_Error on failure 
    147148 */ 
    148 function wp_create_nav_menu( $menu_name ) { 
     149function wp_create_nav_menu( $menu_name, $args=array() ) { 
    149150        $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' ); 
    150151 
    151152        if ( $menu_exists ) 
    152153                return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_name ) ) ); 
    153154 
    154         $menu = wp_insert_term( $menu_name, 'nav_menu' ); 
     155        $menu = wp_insert_term( $menu_name, 'nav_menu', $args ); 
    155156 
    156157        if ( is_wp_error($menu) ) 
    157158                return $menu;