post q("INSERT INTO wp_term_relationships (object_id,term_taxonomy_id) SELECT nid,tid FROM $olddb.term_node;"); #category count q("UPDATE wp_term_taxonomy SET count = (SELECT COUNT(object_id) " . "FROM wp_term_relationships " . "WHERE wp_term_taxonomy.term_id = wp_term_relationships.term_taxonomy_id);"); #comments q("INSERT INTO wp_comments " . "(comment_post_ID, comment_date, comment_content, comment_parent, " . "comment_author, comment_author_email, comment_author_url) " . "SELECT nid, FROM_UNIXTIME(timestamp), " . "comment, thread, name, mail, homepage " . "FROM $olddb.comments ;"); # update comments count on wp_posts table q("UPDATE `wp_posts` SET `comment_count` = (SELECT COUNT(`comment_post_id`) " . "FROM `wp_comments` WHERE `wp_posts`.`id` = `wp_comments`.`comment_post_id`);"); # fix post slugs. first we have to remove the duplicate _____ chars, then replace that with a single - char q("UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');"); q("UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');"); q("UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');"); q("UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');"); q("UPDATE wp_posts set post_name = REPLACE(post_name, '_', '-');"); #users q("INSERT INTO wordpress.wp_users " . "(ID, user_login, user_pass, user_nicename, user_email, user_registered, display_name) " . "SELECT uid, name, pass, name, mail, FROM_UNIXTIME(created), name " . "FROM $olddb.users WHERE uid>1;"); mysqli_close($dbc); ?>