Set meta after new menu is inserted. see #11817

git-svn-id: http://svn.automattic.com/wordpress/trunk@13400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-25 16:49:57 +00:00
parent 9d54f38d89
commit 4039b181c6

View File

@ -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 ) {