Ticket #27113: 27113.1.diff
| File 27113.1.diff, 1003 bytes (added by , 12 years ago) |
|---|
-
src/wp-includes/nav-menu.php
357 357 358 358 $update = 0 != $menu_item_db_id; 359 359 360 // Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms()361 if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) )362 $post['tax_input'] = array( 'nav_menu' => array( intval( $menu->term_id ) ) );363 364 360 // New menu item. Default is draft status 365 361 if ( ! $update ) { 366 362 $post['ID'] = 0; … … 368 364 $menu_item_db_id = wp_insert_post( $post ); 369 365 if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) ) 370 366 return $menu_item_db_id; 367 368 // Associate the menu item with the menu term 369 if ( $menu_id ) { 370 wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' ); 371 } 371 372 } 372 373 373 374 if ( 'custom' == $args['menu-item-type'] ) {