The new WordPress UTW gotcha

(Later – Scroll to the end of this post for a small patch to fix the problem with disappearing tags!)

As seen elsewhere and of course on the official blog, WordPress 2.1 was released to much fanfare yesterday.

It works great, I’ve been using the development version on my blogs for quite a while now and until recently it worked swimmingly. It still does, but some time in the last 2 weeks Ultimate Tag Warrior stopped working properly. Whenever someone made a comment on a post the tags on that post would be deleted. It’s gotten so bad now that I’m moderating all comments, and opening those posts in the editor before approving the comments.

A half-way fix is available but moderated comments will still delete the tags so once I verify that the fix does what it does comment moderation will go back to the way it was before.

You should upgrade WP-Cache to the new 2.0.22 release too. It fixed problems I was seeing here with comments and posts not showing up until I deleted the cache manually. Yay!

If you’re interested, a new WordPress MU release will follow in a day or so. More here.

I forgot to mention, do I recommend you upgrade to WordPress 2.1? Yes. If you run a site that is in any way popular your database server will thank you. WordPress uses the MySQL query cache in a much more efficient manner than ever before when reading posts. Make sure your query cache is activated and tweak it until you hit the sweet spot. It’ll make a big difference when your server is under load.

Fix Fix Fix!

HandySolo spotted a simple fix for the tag problem! Check out the thread on this post and scroll to the entry by where he outlines a simple fix for the disappearing tag problem. I just tried it and it works!

Here’s a temporary patch for resetting tags.
Modify ‘ultimate_save_tags()’ function on ‘ultimate-tag-warrior-actions.php’ about line 502:
if (isset($_POST['comment_post_ID'])) return $postID;
if (isset($_POST['not_spam'])) return $postID; // akismet fix
if (isset($_POST["comment"])) return $postID; // moderation.php fix

Even with the fix above, deleting a comment will delete the tags, and sending a trackback/pingback will do the same. fixed that too. You can remove the above fix and apply the following.
Around line 862 of ultimate-tag-warrior-actions.php find the following chunk of code:

// Save changes to tags
add_action('publish_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('edit_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('save_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('wp_insert_post', array('UltimateTagWarriorActions','ultimate_save_tags'));

Replace that code with:

// Save changes to tags
add_action('save_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
if($wp_db_version < 3308 ) { // if lesser than WP 2.0
  add_action('publish_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
  add_action('edit_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
  add_action('wp_insert_post', array('UltimateTagWarriorActions','ultimate_save_tags'));

PS. Stephen Spencer has discovered why UTW doesn’t always work with custom permalinks. This is a longstanding bug, and it’s why I had to use the ?tag= format on my photoblog.

51 thoughts on “The new WordPress UTW gotcha

  1. Hmm, so wp-cache 2.0.22 works properly for you? For me, comments and posts still don’t show up until I clear cache. :-/

    Thanks for the heads-up on the UTW issue. Gives me something else to test a bit better before I pull the trigger on the upgrade!

  2. Niklas – more here in a few days time 🙂

    michelem – I can use those tags just fine. They’ve been like that for a few years now so I’m quite sure people are used to them by this stage. Are you offering to document the new APIs? The documentation is a volunteer effort and having another hand to help would be great!

  3. HandySolo – That’s unfortunate. All caching problems disappeared when I upgraded. Are you sure you upgraded all files? Or you could downgrade to 2.0.19 again, although that does have a strange ob_flush problem.

    If you do downgrade, grab my patch that improves the caching if you’re getting a lot of spam comments (and who isn’t in this day and age?)

  4. Tom – I can replicate the problem by entering a test comment that akismet will catch (using names like “test commenter99” and email address of “” seems to be a good way to make that happen). Once I release the comment from akismet, tags gone. However…

    Donncha – Did you see the comment from 082net at the UTW release thread? Adding two lines of code seems to have fixed things.

  5. I hope to hear a final version soon.I had been using this plugin and its really awesome.I need not to say that but my thanks for this plugin u made.

    I will keep track of thee post

    Thx and Regards

  6. Thanks HandySolo, that was it. Hopefully Christine will package that fix into a new release soon!

    Matt – nothing stopping ya now from upgrading!

  7. Same here – WP_Cache 2.0.22 didn’t dump the cache on new comments so they didn’t show up. I’m still running an older version for now.

    Still going to try WP 2.1 on a couple of my smaller sites – we’ll see how it goes. Hitting the MySQL query cache more often is a great thing!

  8. Hi Donncha, is that fix for UTW working for you well here.

    I want to upgrade to 2.1, but just holding it off until I’m sure UTW works. After SK2, this is my most needed plugin.

  9. Strange

    I have been running UTW (unpatched) with RC2 for a few days without any problems and quite a few comments.

    I think I might update UTW with the patch and then upgrade to a final release version of WP

  10. I read that earlier today but didn’t upgrade because from the last post on the UTW site and from the strikeout comment at the top it seemed like there was still an issue.

  11. I posted this over on Neato also and wanted to let you know:

    The fix by works; however, if you delete the comment that you approved in the first place, the tags somehow get deleted as well.

  12. I don’t think so… cause my comment just got posted and tags didn’t disappear 🙂

    Thanks for finding this out … !!!

  13. You can also just use

    if (!is_admin()) return $postID;
    if (!isset($_POST[‘tagset’])) return $postID;

    in UTW’s actions file, as per my blog entry from December 😉. Especially the isset($_POST[‘tagset’]) should catch *all* vectors – if the admin is to delete all tags, tagset will be *set* but empty.

  14. Good new fix. Your original fix did just what it was supposed to and the new fix appears to clean up the rest of the incompatibility problems.

    Many thanks

  15. i have another problem with utw, when i try to activate the pluggin, the page goes blank. so i cannot activate it. i never had problems with utw in my last server, now i am migrating everithing and it doesnt work.
    what could it be?

  16. Months later I finally get annoyed and check into this! aghhh. I thought I was doing something wrong with my tags and it was a getting confused, but now I know. Thanks Donncha ! 😀

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.