Make WordPress Core


Ignore:
Timestamp:
02/20/2010 10:44:24 PM (17 years ago)
Author:
ryan
Message:

Set type in post meta. see #11817

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-navigation.php

    r13257 r13261  
    156156                        if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; }
    157157                       
    158                         $post = array( 'post_status' => 'menu-' . $linktype, 'post_type' => 'menu_item', 'post_author' => $user_ID,
    159                                 'ping_status' => 0, 'post_parent' => $post_id, 'menu_order' => $position,
     158                        $post = array( 'post_status' => 'publish', 'post_type' => 'menu_item', 'post_author' => $user_ID,
     159                                'ping_status' => 0, 'post_parent' => $post_id, '`menu_order' => $position,
    160160                                'guid' => $custom_linkurl, 'post_excerpt' => $custom_anchor_title, 'tax_input' => array( 'menu' => $menu_title ),
    161161                                'post_content' => $custom_description, 'post_title' => $custom_title );
    … …  
    167167                        //New menu item
    168168                        if ($db_id == 0) {
    169                                 $post_id = wp_insert_post( $post );
     169                                $db_id = $post_id = wp_insert_post( $post );
    170170                        } elseif ( isset( $menu_items[$db_id] ) ) {
    171171                                foreach( $update_fields as $field ) {
    172172                                        if ( $post[$field] != $menu_items[$db_id]->$field ) {
    173173                                                $post['ID'] = $db_id;
    174                                                 wp_insert_post( $post );
     174                                                wp_update_post( $post );
    175175                                                break;
    176176                                        }
    … …  
    178178                                unset( $menu_items[$db_id] );
    179179                        }
     180                        update_post_meta($db_id, 'menu_type', $linktype);
    180181                }
    181182                if ( !empty( $menu_items ) ) {
Note: See TracChangeset for help on using the changeset viewer.