Simple Tagging Categories Import Fix
March 17th, 2007 | Posted in Development, Wordpress | 1 Comments
There are many WP tagging plugins available, having tried them all I found Simple Tagging the easiest to use and implement.
Once installed you get the option to import categories as tags, problem is that it throws the following sql error:
-
WordPress database error: [Unknown COLUMN ‘p2c.category_id’ in ‘on clause’]
-
SELECT cats.cat_name, p2c.post_id FROM wp_posts posts INNER JOIN wp_categories cats ON (p2c.category_id = cats.cat_id) LEFT JOIN wp_post2cat p2c ON (posts.ID = p2c.post_id) WHERE posts.post_status IN (’publish’) AND posts.post_type <> ‘page’
To fix this you need to replace a sql query in simpletagging.admin.php on line 473.
Replace:
-
$qry = "SELECT cats.cat_name, p2c.post_id FROM $wpdb->posts posts
-
INNER JOIN $wpdb->categories cats ON (p2c.category_id = cats.cat_id)
-
LEFT JOIN $wpdb->post2cat p2c ON (posts.ID = p2c.post_id)
-
WHERE posts.post_status IN (’publish’)
-
AND posts.post_type <> ‘page’";
with
-
$qry = "SELECT p2c.post_id , cats.cat_name
-
FROM $wpdb->posts posts, $wpdb->post2cat p2c, $wpdb->categories cats
-
WHERE p2c.category_id = cats.cat_ID AND posts.ID = p2c.post_id
-
AND posts.post_status IN (’publish’) AND posts.post_type <> ‘page’";
This fix worked for me, and for others. To be safe, backup your database. Before using it may be worthwhile checking with the authors site for a newer version with a fix already in place.












Hay
assistant prefer to commiserate with with BBcode :( for me does not veer out to spawn references to the gripping pictures and video on the topic. Or regurgitate down affiliation on this topic