Set meta after new menu is inserted. see #11817

git-svn-id: https://develop.svn.wordpress.org/trunk@13400 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-02-25 16:49:57 +00:00
parent 1fa94a6e1e
commit 22584331dc
1 changed files with 8 additions and 7 deletions

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