Index: wp-includes/post.php =================================================================== --- wp-includes/post.php (revision 6568) +++ wp-includes/post.php (working copy) @@ -951,7 +951,8 @@ $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, - 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => ''); + 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', + 'guid' => ''); $postarr = wp_parse_args($postarr, $defaults); $postarr = sanitize_post($postarr, 'db'); @@ -989,6 +990,10 @@ if ( $update ) $post_ID = (int) $ID; + // Get the post GUID. + if ( $update ) + $guid = get_post_field('guid',$post_ID); + // Create a valid post name. Drafts are allowed to have an empty // post name. if ( empty($post_name) ) { @@ -1073,7 +1078,7 @@ } // expected_slashed (everything!) - $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order' ) ); + $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); $data = stripslashes_deep( $data ); $where = array( 'ID' => $post_ID ); @@ -1096,6 +1101,8 @@ wp_set_post_categories( $post_ID, $post_category ); wp_set_post_tags( $post_ID, $tags_input ); + $current_guid = get_post_field( 'guid', $post_ID ); + if ( 'page' == $post_type ) { clean_page_cache($post_ID); } else { @@ -1104,7 +1111,8 @@ // Set GUID if ( ! $update ) - $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); + if( '' == $current_guid ) + $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); $post = get_post($post_ID); if ( !empty($page_template) ) @@ -2542,9 +2550,10 @@ global $wpdb; if ( $old_status != 'publish' && $new_status == 'publish' ) { + if ( '' == get_the_guid($post->ID) ) // Reset GUID if transitioning to publish. $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); - do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish + do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish } // Always clears the hook in case the post status bounced from future to draft. @@ -2636,4 +2645,4 @@ } } -?> \ No newline at end of file +?> Index: wp-admin/import/rss.php =================================================================== --- wp-admin/import/rss.php (revision 6568) +++ wp-admin/import/rss.php (working copy) @@ -71,7 +71,7 @@ $cat_index++; } - preg_match('|(.*?)|is', $post, $guid); + preg_match('|(.*?)|is', $post, $guid); if ($guid) $guid = $wpdb->escape(trim($guid[1])); else