Make WordPress Core

Changeset 13279


Ignore:
Timestamp:
02/21/2010 10:51:34 AM (15 years ago)
Author:
dd32
Message:

Fix New Menu term handling. See #11817

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-navigation.php

    r13271 r13279  
    9797            $existing_term = get_term_by( 'name', $insert_menu_name, 'menu' );
    9898            if ( $existing_term ) {
    99                 $messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$insert_menu_name.' Menu has already created - please try another name</p></div>';
     99                $messagesdiv = '<div id="message" class="error fade below-h2"><p>' . $insert_menu_name . ' Menu has already created - please try another name</p></div>';
    100100            } else {
    101101                $term = wp_insert_term( $insert_menu_name, 'menu' );
    102                 if ( $term ) {
    103                     $custom_menus[$term['term_id']] = $term;
    104                     $menu_selected_id = $term['term_id'];
     102                if ( !is_wp_error($term) ) {
     103                    $term = get_term($term['term_id'], 'menu');
     104                    $custom_menus[$term->term_id] = $term;
     105                    $menu_selected_id = $term->term_id;
    105106                    $menu_id_in_edit = $menu_selected_id;
    106                     $messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$term['name'].' Menu has been created!</p></div>';
     107                    $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . $term->name . ' Menu has been created!</p></div>';
    107108
    108109                    $postCounter = 0;
Note: See TracChangeset for help on using the changeset viewer.