Fix New Menu term handling. See #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d6397b1ab5
commit
9f8fde7c96
|
@ -96,14 +96,15 @@ function wp_custom_navigation() {
|
||||||
if ( $insert_menu_name != '' ) {
|
if ( $insert_menu_name != '' ) {
|
||||||
$existing_term = get_term_by( 'name', $insert_menu_name, 'menu' );
|
$existing_term = get_term_by( 'name', $insert_menu_name, 'menu' );
|
||||||
if ( $existing_term ) {
|
if ( $existing_term ) {
|
||||||
$messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$insert_menu_name.' Menu has already created - please try another name</p></div>';
|
$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . $insert_menu_name . ' Menu has already created - please try another name</p></div>';
|
||||||
} else {
|
} else {
|
||||||
$term = wp_insert_term( $insert_menu_name, 'menu' );
|
$term = wp_insert_term( $insert_menu_name, 'menu' );
|
||||||
if ( $term ) {
|
if ( !is_wp_error($term) ) {
|
||||||
$custom_menus[$term['term_id']] = $term;
|
$term = get_term($term['term_id'], 'menu');
|
||||||
$menu_selected_id = $term['term_id'];
|
$custom_menus[$term->term_id] = $term;
|
||||||
|
$menu_selected_id = $term->term_id;
|
||||||
$menu_id_in_edit = $menu_selected_id;
|
$menu_id_in_edit = $menu_selected_id;
|
||||||
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$term['name'].' Menu has been created!</p></div>';
|
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . $term->name . ' Menu has been created!</p></div>';
|
||||||
|
|
||||||
$postCounter = 0;
|
$postCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue