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 , 14 years ago) |
---|
-
trunk/wp-includes/nav-menu.php
143 143 * @since 3.0.0 144 144 * 145 145 * @param string $menu_name Menu Name 146 * @param string $args Optional. 146 147 * @return mixed Menu object on success|WP_Error on failure 147 148 */ 148 function wp_create_nav_menu( $menu_name ) {149 function wp_create_nav_menu( $menu_name, $args=array() ) { 149 150 $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' ); 150 151 151 152 if ( $menu_exists ) 152 153 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 ) ) ); 153 154 154 $menu = wp_insert_term( $menu_name, 'nav_menu' );155 $menu = wp_insert_term( $menu_name, 'nav_menu', $args ); 155 156 156 157 if ( is_wp_error($menu) ) 157 158 return $menu;