New here? Then you may want to subscribe to my rss feed. :)

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:

MySQL [Show Plain Code]:
  1. WordPress database error: [Unknown COLUMN ‘p2c.category_id’ in ‘on clause’]
  2. 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:

  1. $qry = "SELECT cats.cat_name, p2c.post_id FROM $wpdb->posts posts
  2. INNER JOIN $wpdb->categories cats ON (p2c.category_id = cats.cat_id)
  3. LEFT JOIN $wpdb->post2cat p2c ON (posts.ID = p2c.post_id)
  4. WHERE posts.post_status IN (’publish’)
  5. AND posts.post_type <> ‘page’";

with

  1. $qry = "SELECT  p2c.post_id , cats.cat_name 
  2. FROM $wpdb->posts posts, $wpdb->post2cat p2c, $wpdb->categories cats
  3. WHERE p2c.category_id = cats.cat_ID AND posts.ID = p2c.post_id
  4. 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.

One Response to “Simple Tagging Categories Import Fix”

  • Gravatar
    Orgarveowerve Location: Germany //

    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

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>