-- this script converts the posts from wheatblog into wordpress -- use with care!!! -- backup your wheatblog before you start and try each statement before you continue -- by ruben barkow (rubo77) http://entikey.z11.de -- add posts: INSERT INTO `wordpress`.`wp_posts` ( `ID` , `post_author` , `post_date` , `post_date_gmt` , `post_content` , `post_title` , `post_category` , `post_excerpt` , `post_status` , `comment_status` , `ping_status` , `post_password` , `post_name` , `to_ping` , `pinged` , `post_modified` , `post_modified_gmt` , `post_content_filtered` , `post_parent` , `guid` , `menu_order` , `post_type` , `post_mime_type` , `comment_count` ) ( SELECT `id` as ID , '1' as `post_author`, concat(year,'-',LPAD(month, 2, '0') ,'-',LPAD(date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )) as `post_date` , concat(year,'-',LPAD(month, 2, '0') ,'-',LPAD(date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )) as `post_date_gmt`, `body` , concat(`username`,':',`title`) as `post_title` , '0', '', if(`showpref`,'publish','private') as `post_status`, 'open', 'closed', '', concat(`username`,':',`title`) as `post_name`, '', '', concat(year,'-',LPAD(month, 2, '0') ,'-',LPAD(date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )), concat(year,'-',LPAD(month, 2, '0') ,'-',LPAD(date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )), '', '0', '', '0', 'post', '',`comments` FROM wheatblog.`wbtbl_posts` ); -- add comments: --------------------------------------- INSERT INTO `wordpress`.`wp_comments` ( `comment_ID` , `comment_post_ID` , `comment_author` , `comment_author_email` , `comment_author_url` , `comment_author_IP` , `comment_date` , `comment_date_gmt` , `comment_content` , `comment_karma` , `comment_approved` , `comment_agent` , `comment_type` , `comment_parent` , `user_id` ) ( SELECT NULL, `post_id`, `comment_author_name`, `comment_author_email`, if(`comment_author_url`='http://','',`comment_author_url`), '::ffff:192.168.0.2', concat(comment_year,'-',LPAD(comment_month, 2, '0') ,'-',LPAD(comment_date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )) as `comment_date` , concat(comment_year,'-',LPAD(comment_month, 2, '0') ,'-',LPAD(comment_date, 2, '0'), ' ', SUBSTRING( `timestamp`, -14, 8 )) as `comment_date_g` , `comment_body` , '0', '1', 'unknown', '', '0', '1' FROM wheatblog.`wbtbl_comments` ); -- to get the right commentcount: SELECT count( comment_ID ) , `wp_posts`. * FROM `wp_posts` , wp_comments WHERE wp_comments.comment_post_ID = `wp_posts`.ID GROUP BY wp_comments.comment_post_ID; -- create the last statement as VIEW `temporaer`, and then: UPDATE `wp_posts` SET `comment_count` = ( SELECT `count( comment_ID )` FROM temporaer WHERE temporaer.`ID` = `wp_posts`.`ID` ) ; -- some more features: -- to give some posts the user "ruben": UPDATE `wp_comments` SET `user_id` =39 WHERE `comment_author` LIKE 'ruben' ; UPDATE `wp_posts` SET `post_author` =39 WHERE post_title like 'Ruben:%'; -- if all old posts should get the tag for example with the term nr 12, use this: SELECT concat("INSERT INTO `wordpress`.`wp_term_relationships` (`object_id` ,`term_taxonomy_id` ,`term_order`) VALUES ('",`ID`,"', '12', '0');") FROM `wp_posts`; -- correct wrong umlaute: UPDATE `wp_posts` SET post_title = replace( post_title , 'ö', 'ö' ) ; UPDATE `wp_posts` SET `post_content` = replace( `post_content` , 'ö', 'ö' ) ; UPDATE `wp_posts` SET post_title = replace( post_title , 'ß', 'ß' ) ; UPDATE `wp_posts` SET `post_content` = replace( `post_content` , 'ß', 'ß' ) ; UPDATE `wp_posts` SET post_title = replace( post_title , 'ü', 'ü' ) ; UPDATE `wp_posts` SET `post_content` = replace( `post_content` , 'ü', 'ü' ) ; UPDATE `wp_comments` SET `comment_content` = replace( `comment_content` , 'ä', 'ä' ) ; UPDATE `wp_comments` SET `comment_content` = replace( `comment_content` , 'ö', 'ö' ) ; UPDATE `wp_comments` SET `comment_content` = replace( `comment_content` , 'ü', 'ü' ) ; UPDATE `wp_comments` SET `comment_content` = replace( `comment_content` , 'ß', 'ß' ) ; UPDATE `wp_posts` SET post_title = replace( post_title , 'ä', 'ä' ) ; UPDATE `wp_posts` SET `post_content` = replace( `post_content` , 'ä', 'ä' ) ;