migrate comments from an old Wordpress database to new DB with different post ID's
Posted on 2011-10-04
Simple description: How can I migrate post comments from an old WP site where the post ID's are different on the new site?
We are migrating away from an old custom CMS. It uses a mySQL DB to hold its articles. Comments were an afterthought, and we simply added a link at the end of each article to a wordpress post that merely held comments.
The articles DB table has two useful fields: article name, and the post ID of the corresponding WP post of the comments.
We need to import the comments into the new fully wordpress-based site. All articles have been imported to posts. Those post ID's do not match up to the comment posts on the old WP site.
To locate comments to import, the old articles database must be searched for a post title from the new WP database. The old/new titles are only similar, but will usually match up. When a title is matched, the blog_link field will reference the post ID of the corresponding comment post. Then I can replace the comment_post_ID in each old comment with the new post ID and insert all those into the new site comment table.
There's my outline. Can anyone suggest any helpful tools? Maybe an application or PHP API/framework for sorting and processing through multiple databases?