Apperantlly the wp_terms table was not converted while i updated the WordPress installation to the latest. so i had to do it manually
here is how.
I logged in to the SQL admin and ran these 2 SQL commands
INSERT INTO wp_terms (term_id, name, slug, term_group) select tag_id,tag,tag,0 from wp_tags;
to get the categories across and then
INSERT INTO wp_term_relationships select tag_id, post_id,0 from wp_post2tag
the only table that i need to write code to fix is the taxonomy extended table which is more like elaboratoin of the tags.
Update!
I have managed to solve the extended taxonomy using a help from Jamine Kapish who wrote a full import script.
i have ran alteration of his script written based on his script i found in this post
define('DBNAME', '?'); // The name of the database
define('USERNAME', '?'); // Your MySQL username
define('PASSWORD', '?'); // ...and password
define('HOSTNAME', '?');
/* DO NOT CHANGE ANYTHING AFTER THIS UNLESS YOU KNOW WHAT YOU ARE DOING */
$conn = mysql_connect(HOSTNAME, USERNAME, PASSWORD);
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db(DBNAME)) {
echo "Unable to select DATABASE : " . mysql_error();
exit;
}
$wptagsQuery = "SELECT * FROM wp_tags";
$wptagsResult = mysql_query($wptagsQuery) or die(mysql_error());
while ($wptagsRow = mysql_fetch_assoc($wptagsResult)) {
$terms_id = mysql_insert_id();
$countPostsQuery = "SELECT count(post_id) AS countPosts FROM wp_post2tag WHERE tag_id = " . $wptagsRow["tag_ID"];
$countPostsResult = mysql_query($countPostsQuery) or die(mysql_error());
$countPostsRow = mysql_fetch_assoc($countPostsResult) or die(mysql_error());
$termsTaxonomyInsertQuery = "INSERT INTO
wp_term_taxonomy
(term_taxonomy_id, term_id, taxonomy, description, parent, count)
VALUES
(0, $terms_id, 'post_tag', '', 0, ".$countPostsRow["countPosts"].")";
echo $termsTaxonomyInsertQuery;
$termsTaxonomyInsertResult = mysql_query($termsTaxonomyInsertQuery) or die(mysql_error());
}
?>
Hope this helps.
[…] 3 days ago # I have solved the issue with a few SQL and php scripts they can be found in a post i wrote about it […]