Support » Fixing WordPress » Importing posts from another WP Blog

  • I’ve been using WP for almost a year now. Recently I switched domains and decided to start a fresh database. However, now I want to include the posts from my old domain – I’ve tried simply copying the sql code over, but I get an error on line 478 of wp-blog-header.php (which seems to be dealing with categories – which I also copied the sql code from the old site over from).
    Is there an easy way to copy the old posts over? I’ve tried searching but that just turned up threads about importing from Blogger etc
    Edit: both blogs are running WordPress 1.2.

Viewing 14 replies - 1 through 14 (of 14 total)
  • http://www.tamba2.org.uk/wordpress/backup/
    That works for moving data in and out of the db.
    Did you literally just download the db, and all the folders then move them ?

    No, I installed a completely clean WP into the new domain. I’ve decided now thought that I would like the old posts.
    I’ll try the link you’ve posted and get back to you

    I installed the backup/restore script, and uploaded the .sql file which had the wp_posts table from the old database. The restore function said it worked correctly and all posts seem to have been restored correctly.
    However, when I view an old entry which I imported from the old database I get the following before any other output is made:
    Warning: Invalid argument supplie for foreach() in /home/harmonic/public_html/wp-blog-header.php on line 478
    See here for the error: http://harmonicechos.com/archives/somewhere-with-the-wind
    A new entry that doesn’t include the error:
    http://harmonicechos.com/archives/ucas-personal-statement
    I have copied the wp_categories table across from the old database, but I presume this is because I haven’t copied the old wp_post2cat table across? Is there any way to rebuild this? or do I have to manually enter the post numbers etc?

    Does anyone have any ideas on this?

    You should have backed up the DB in your old site and restored it to the new one using the version of WP you used before and then upgrade to the new one before writing your new entries.
    I’m not making sense.

    couldn’t you just manually install the posts?
    dunnoe what the bd commands would be, but unless there are hundreds of entries it is an option, at least.
    f.

    Your main problem will probably be having identical (post)ID numbers in both databases…

    That’s what I was thinking. I don’t really want to (or have time to) enter all the posts manually.
    I suppose the best thing to do, would be to import the old domain posts (ceejaycee.net) into a clean database – then manually enter the new domain posts (harmonicechos.com) by hand. Unless anyone can think of anything better.

    No idea as I’ve never used it myself, but might the rss import work?

    I’ve used RSS import to backup and restore my WordPress entries. It works. Make sure you increase the number of entries in your RSS feed first.

    As a temporary measure, till wp has an xml import-export, you can use the export to mt format script, and then use the normal import-mt.php.
    So the idea is, you use the script to export the wp posts in a text file in the mt format, and then import it using import-mt.php
    You can find the scripts at papascott, and you can find my version at the following url:
    http://blog.carthik.net/wpexportv2.phps

    Thanks 2fargon. I’ll try this later tonight 🙂

    Just thought I’d update this to say, that I eventually got round to trying the import to mt, import to wp method and it worked!

    Thanks to all that helped 🙂

    You know, I’ve been trying to figure out how to do this for about a week now. I’m in almost exactly the same situation as CJC was, but I was getting ready to roll my own solution – kind of as a PHP excercise.

    But no point reinventing the wheel if it ain’t broke 🙂

    Soooo, 2fargon, when I run your script on me blog (the old one, this is), it looks like it’s getting all the posts and comments, but the very last line is a MySQL warning about mysql_affected_rows(). Issat normal?

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.