A Dirty Hack to Fix the Disappearing Tags Problem in Ultimate Tag Warrior

Ultimate Tag Warrior is a great WordPress plugin that lets you add tagging to your blog and build your own folksonomy. You can use it to show related posts or a nifty tag cloud.

As of version 2.3, though, Worpdress has tagging built right in. That means that development on UTW has stopped, leaving us with a very nasty bug in the final version. After someone comments on a post (and the comment is approved), all the non-category tags are deleted.

This is a known bug in UTW 3.1415926. I’m not quite ready to take the plunge into WordPress 2.3, digging up new plugins to add the features I want and changing our theme. So in the mean time, I found an ugly hack to stop our tags from vanshing into thin air.

  1. Go to your ultimate-tag-warrior-core.php file.
  2. Find the SaveTags function.
  3. Comment out the code that removes tags that are no longer associated with the post.

The end of the SaveTags function should look like this:

// Remove any tags that are no longer associated with the post.
/*
if ($taglist == “”) {
// since “not in ()” doesn’t play nice.
$q = “delete from $tablepost2tag where post_id = $postID”;
} else {
// lop off the trailing space+comma
$taglist = substr($taglist, 0 ,-2);

$q = “delete from $tablepost2tag where post_id = $postID and tag_id not in ($taglist)”;
}
$wpdb->query($q);
*/
$this->ClearTagPostMeta($postID);
}

Please note that this is an ugly hack.  It makes it much more difficult to remove tags from a post when you want to.  I find that we get comments on posts way more often than we ever want to remove tags, so it’s a god tradeoff for the time being.

Got a better solution?  Post it in the comment below.

Written by Jason

Last 3 posts by Jason

  1. I have a plugin which is currently in closed beta that will do UTW template tag stuff; but using the tags that are stored in WordPress.

    So unless you’re doing gnarly-gnarly stuff in your theme; you should be able to import tags into wordpress and enable the shiny new plugin, and it’ll all just work. In theory.

    If there’s other UTW stuff that you’re clinging to, let me know and I’ll see what I can wrangle – I have admin plugins and suggest plugins and stuff kicking around.

    Christine From The Internet
    October 30th, 2007 at 12:30 am
  2. Nice and dirty, just waht I was looking for.

    Thank you!

    Henri
    March 8th, 2008 at 6:41 pm

Post a Comment

(or leave a trackback to your blog)