WordPress.org

Make WordPress Core

Changeset 2193


Ignore:
Timestamp:
02/01/2005 10:04:01 AM (13 years ago)
Author:
saxmatt
Message:

Preserve GUIDs in imports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import-rss.php

    r1950 r2193  
    111111endif;
    112112
     113preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid);
     114if ($guid) $guid = addslashes( trim($guid[1]) );
     115else $guid = '';
     116
    113117preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $content);
    114118$content = str_replace( array('<![CDATA[', ']]>'), '', addslashes( trim($content[1]) ) );
     
    138142   
    139143    $wpdb->query("INSERT INTO $wpdb->posts
    140         (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
     144        (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid)
    141145        VALUES
    142         ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
     146        ('$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')");
    143147    $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
    144148    if (!$post_id) die("couldn't get post ID");
Note: See TracChangeset for help on using the changeset viewer.