Don't pass a slug when creating anew menu. This prevents creating a menu whose slug matches a different term in another taxonomy. Props filosofo. fixes #13345
git-svn-id: http://svn.automattic.com/wordpress/trunk@14590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e15c230ffc
commit
7231cc8a56
|
@ -91,12 +91,7 @@ function wp_create_nav_menu( $menu_name, $args = array() ) {
|
||||||
if ( $menu_exists )
|
if ( $menu_exists )
|
||||||
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 ) ) );
|
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 ) ) );
|
||||||
|
|
||||||
if ( isset($args['slug']) )
|
$menu = wp_insert_term( $menu_name, 'nav_menu' );
|
||||||
$slug = $args['slug'];
|
|
||||||
else
|
|
||||||
$slug = $menu_name;
|
|
||||||
|
|
||||||
$menu = wp_insert_term( $menu_name, 'nav_menu', array('slug' => $slug) );
|
|
||||||
|
|
||||||
if ( is_wp_error($menu) )
|
if ( is_wp_error($menu) )
|
||||||
return $menu;
|
return $menu;
|
||||||
|
|
Loading…
Reference in New Issue