| 1 | Index: wp-includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post.php (revision 6568) |
|---|
| 4 | +++ wp-includes/post.php (working copy) |
|---|
| 5 | @@ -951,7 +951,8 @@ |
|---|
| 6 | |
|---|
| 7 | $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, |
|---|
| 8 | 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, |
|---|
| 9 | - 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => ''); |
|---|
| 10 | + 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', |
|---|
| 11 | + 'guid' => ''); |
|---|
| 12 | |
|---|
| 13 | $postarr = wp_parse_args($postarr, $defaults); |
|---|
| 14 | $postarr = sanitize_post($postarr, 'db'); |
|---|
| 15 | @@ -989,6 +990,10 @@ |
|---|
| 16 | if ( $update ) |
|---|
| 17 | $post_ID = (int) $ID; |
|---|
| 18 | |
|---|
| 19 | + // Get the post GUID. |
|---|
| 20 | + if ( $update ) |
|---|
| 21 | + $guid = get_post_field('guid',$post_ID); |
|---|
| 22 | + |
|---|
| 23 | // Create a valid post name. Drafts are allowed to have an empty |
|---|
| 24 | // post name. |
|---|
| 25 | if ( empty($post_name) ) { |
|---|
| 26 | @@ -1073,7 +1078,7 @@ |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | // expected_slashed (everything!) |
|---|
| 30 | - $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' ) ); |
|---|
| 31 | + $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' ) ); |
|---|
| 32 | $data = stripslashes_deep( $data ); |
|---|
| 33 | $where = array( 'ID' => $post_ID ); |
|---|
| 34 | |
|---|
| 35 | @@ -1096,6 +1101,8 @@ |
|---|
| 36 | wp_set_post_categories( $post_ID, $post_category ); |
|---|
| 37 | wp_set_post_tags( $post_ID, $tags_input ); |
|---|
| 38 | |
|---|
| 39 | + $current_guid = get_post_field( 'guid', $post_ID ); |
|---|
| 40 | + |
|---|
| 41 | if ( 'page' == $post_type ) { |
|---|
| 42 | clean_page_cache($post_ID); |
|---|
| 43 | } else { |
|---|
| 44 | @@ -1104,7 +1111,8 @@ |
|---|
| 45 | |
|---|
| 46 | // Set GUID |
|---|
| 47 | if ( ! $update ) |
|---|
| 48 | - $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); |
|---|
| 49 | + if( '' == $current_guid ) |
|---|
| 50 | + $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); |
|---|
| 51 | |
|---|
| 52 | $post = get_post($post_ID); |
|---|
| 53 | if ( !empty($page_template) ) |
|---|
| 54 | @@ -2542,9 +2550,10 @@ |
|---|
| 55 | global $wpdb; |
|---|
| 56 | |
|---|
| 57 | if ( $old_status != 'publish' && $new_status == 'publish' ) { |
|---|
| 58 | + if ( '' == get_the_guid($post->ID) ) |
|---|
| 59 | // Reset GUID if transitioning to publish. |
|---|
| 60 | $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); |
|---|
| 61 | - do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish |
|---|
| 62 | + do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | // Always clears the hook in case the post status bounced from future to draft. |
|---|
| 66 | @@ -2636,4 +2645,4 @@ |
|---|
| 67 | } |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | -?> |
|---|
| 71 | \ No newline at end of file |
|---|
| 72 | +?> |
|---|
| 73 | Index: wp-admin/import/rss.php |
|---|
| 74 | =================================================================== |
|---|
| 75 | --- wp-admin/import/rss.php (revision 6568) |
|---|
| 76 | +++ wp-admin/import/rss.php (working copy) |
|---|
| 77 | @@ -71,7 +71,7 @@ |
|---|
| 78 | $cat_index++; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | - preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid); |
|---|
| 82 | + preg_match('|<guid.*?>(.*?)</guid>|is', $post, $guid); |
|---|
| 83 | if ($guid) |
|---|
| 84 | $guid = $wpdb->escape(trim($guid[1])); |
|---|
| 85 | else |
|---|