From 4039b181c6a9170bf7f3a509830e39844345837c Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 25 Feb 2010 16:49:57 +0000 Subject: [PATCH] Set meta after new menu is inserted. see #11817 git-svn-id: http://svn.automattic.com/wordpress/trunk@13400 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/nav-menus.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 0cd99efcbb..6b821d4100 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -119,16 +119,10 @@ if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) { 'ping_status' => 0, 'post_parent' => 0, 'menu_order' => $position, 'post_excerpt' => $custom_anchor_title, 'tax_input' => array( 'nav_menu' => $menu_title ), 'post_content' => $custom_description, 'post_title' => $custom_title ); - if ( $new_window ) - update_post_meta( $db_id, 'menu_new_window', 1 ); - else - update_post_meta( $db_id, 'menu_new_window', 0 ); + if ( $parent_id > 0 && isset( $parent_menu_ids[$parent_id] ) ) $post['post_parent'] = $parent_menu_ids[$parent_id]; - if ( $custom_linkurl ) - update_post_meta( $db_id, 'menu_link', esc_url_raw( $custom_linkurl ) ); - // New menu item if ( $db_id == 0 ) { $db_id = wp_insert_post( $post ); @@ -141,6 +135,13 @@ if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) { update_post_meta( $db_id, 'menu_type', $linktype ); update_post_meta( $db_id, 'object_id', $object_id ); + if ( $new_window ) + update_post_meta( $db_id, 'menu_new_window', 1 ); + else + update_post_meta( $db_id, 'menu_new_window', 0 ); + if ( $custom_linkurl ) + update_post_meta( $db_id, 'menu_link', esc_url_raw( $custom_linkurl ) ); + } if ( !empty( $menu_items ) ) { foreach ( array_keys( $menu_items ) as $menu_id ) {