From a157ff8eb0340ff2eeec96092481dea689a5f036 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 20 Feb 2010 22:44:24 +0000 Subject: [PATCH] Set type in post meta. see #11817 git-svn-id: https://develop.svn.wordpress.org/trunk@13261 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-navigation.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-admin/custom-navigation.php b/wp-admin/custom-navigation.php index 44bad2740e..463cac5d67 100644 --- a/wp-admin/custom-navigation.php +++ b/wp-admin/custom-navigation.php @@ -155,8 +155,8 @@ function wp_custom_navigation() { if (isset($_POST['anchortitle'.$k])) { $custom_anchor_title = stripslashes($_POST['anchortitle'.$k]); } else { $custom_anchor_title = $custom_title; } if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; } - $post = array( 'post_status' => 'menu-' . $linktype, 'post_type' => 'menu_item', 'post_author' => $user_ID, - 'ping_status' => 0, 'post_parent' => $post_id, 'menu_order' => $position, + $post = array( 'post_status' => 'publish', 'post_type' => 'menu_item', 'post_author' => $user_ID, + 'ping_status' => 0, 'post_parent' => $post_id, '`menu_order' => $position, 'guid' => $custom_linkurl, 'post_excerpt' => $custom_anchor_title, 'tax_input' => array( 'menu' => $menu_title ), 'post_content' => $custom_description, 'post_title' => $custom_title ); if ( $new_window ) @@ -166,17 +166,18 @@ function wp_custom_navigation() { //New menu item if ($db_id == 0) { - $post_id = wp_insert_post( $post ); + $db_id = $post_id = wp_insert_post( $post ); } elseif ( isset( $menu_items[$db_id] ) ) { foreach( $update_fields as $field ) { if ( $post[$field] != $menu_items[$db_id]->$field ) { $post['ID'] = $db_id; - wp_insert_post( $post ); + wp_update_post( $post ); break; } } unset( $menu_items[$db_id] ); } + update_post_meta($db_id, 'menu_type', $linktype); } if ( !empty( $menu_items ) ) { foreach( array_keys( $menu_items ) as $menu_id ) {