Fix New Menu term handling. See #11817
git-svn-id: https://develop.svn.wordpress.org/trunk@13279 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c55a0f2364
commit
cdf95010d4
|
@ -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