From 6611d8e688cb5635ae23375c62b20f42ef5f1c16 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Tue, 1 Feb 2005 10:04:01 +0000 Subject: [PATCH] Preserve GUIDs in imports git-svn-id: https://develop.svn.wordpress.org/trunk@2193 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/import-rss.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/import-rss.php b/wp-admin/import-rss.php index 327e507e73..55bf89aa24 100644 --- a/wp-admin/import-rss.php +++ b/wp-admin/import-rss.php @@ -110,6 +110,10 @@ if (!$categories) : $categories = $categories[1]; endif; +preg_match('|(.*?)|is', $post, $guid); +if ($guid) $guid = addslashes( trim($guid[1]) ); +else $guid = ''; + preg_match('|(.*?)|is', $post, $content); $content = str_replace( array(''), '', addslashes( trim($content[1]) ) ); @@ -137,9 +141,9 @@ if ($dupe) : else : $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name) + (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid) VALUES - ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')"); + ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')"); $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); if (!$post_id) die("couldn't get post ID"); if (0 != count($categories)) :