• amtho

    (@amtho)


    Hi there,

    Much like this person, I wanted to move my data from an older server to a newer server. I upgraded the old installation & set up a fresh install on the new server – 2.3.3 on both. I exported & imported — but no descriptions/excerpts!

    I looked at the XML file and found something like:

    <description></description>

    Here’s how I fixed it. I’m not sure why it’s not in the code like this already, but it was really easy once I figured out the data structure, object structure, and a little basic PHP.

    First, to import the data: I edited the file wp-admin/import/wordpress.php. After line 312, I added this:

    // --  AMT added code
    
    $post_excerpt = $this->get_tag( $post, 'excerpt' );
    $post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
    $post_excerpt = str_replace('<br>', '', $post_excerpt);
    $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
    
    // -- end added code

    You’ll notice that I’m looking for the tag named ‘excerpt’ instead of ‘description’ – I’m not sure why ‘description’ was used before, but this seemed more consistent. Don’t really care that much. I’m fully aware that there are probably naming conventions here of which I’m not aware.

    Then, I edited wp-admin/export.php. I changed line 223 to:

    <excerpt><?php echo $post->post_excerpt ?></excerpt>

    Before, it was just:

    <description></description>

    (or something similar).

    Then, I was able to replace the files on both installations of WordPress, export, and import, and all my descriptions came through! Yay!

    So what’s my question?

    1) Should I incorporate this into just *my* installation of WordPress? What should I do with this? Is it misguided somehow?

    2) If this represents an actual bug, is there somewhere I should report it?

    Thanks,
    AMtho

  • The topic ‘Export/Import with excerpts — I hacked it’ is closed to new replies.