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 082net.com 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. 082net.com 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 Comments

michelem (1 comments.) on January 23, 2007 at 12:58 pm.

can you use a template tag like this:

&after=&show_images=1&show_description=0&orderby=url); ?>

(I took it from here http://codex.wordpress.org/Template_Tags/wp_list_bookmarks)

And where is the others new APIs in codex? Sorry, but I dont think this is a good work…

Reply

Niklas (1 comments.) on January 23, 2007 at 1:13 pm.

Hm, more where, exactly?

Reply

HandySolo (4 comments.) on January 23, 2007 at 1:44 pm.

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!

Reply

Donncha (1707 comments.) on January 23, 2007 at 1:49 pm.

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!

Reply

Donncha (1707 comments.) on January 23, 2007 at 1:57 pm.

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?)

Reply

Tom Raftery (3 comments.) on January 23, 2007 at 2:13 pm.

I don’t seem to have the utw problem after the upgrade (unless I understood your explanation – quite likely!).

I am using utw 3.141592

Tom

Reply

HandySolo (4 comments.) on January 23, 2007 at 3:26 pm.

Tom – I can replicate the problem by entering a test comment that akismet will catch (using names like “test commenter99″ and email address of “test@test.com” 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.

Reply

Ashish Mohta (1 comments.) on January 23, 2007 at 3:29 pm.

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
Ashish

Reply

Matt Wiebe (1 comments.) on January 23, 2007 at 3:33 pm.

I don’t think that I’m game to upgrade to WP2.1 until this UTW thing is sorted out. How annoying! (The joys of the upgrade path ;) )

Reply

Donncha (1707 comments.) on January 23, 2007 at 3:46 pm.

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

Matt – nothing stopping ya now from upgrading!

Reply

Soccer Dad (1 comments.) on January 23, 2007 at 3:55 pm.

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!

Reply

Brennan (1 comments.) on January 23, 2007 at 4:09 pm.

No wonder my tags had been mysteriously disspearing. Thanks, Donncha!

Reply

Ajay (3 comments.) on January 23, 2007 at 6:10 pm.

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.

Reply

Donncha (1707 comments.) on January 23, 2007 at 6:13 pm.

Ajay – it works fine, on this blog and on http://inphotos.org/ too, and I’ve approved several comments since applying the fix!

Reply

Andy Beard (2 comments.) on January 23, 2007 at 6:51 pm.

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

Reply

BigBerries (1 comments.) on January 24, 2007 at 12:33 am.

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.

Reply

Donncha (1707 comments.) on January 24, 2007 at 12:37 am.

BigBerries – it’s working fine now. I approved your comment and my tags are still there :)

Reply

Bes Zain (1 comments.) on January 24, 2007 at 12:56 am.

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

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

Reply

Ajay (3 comments.) on January 24, 2007 at 3:40 am.

Great to hear that Donncha, but will I need to moderate my comments?

Reply

Ajay (3 comments.) on January 24, 2007 at 3:43 am.

I don’t think so… cause my comment just got posted and tags didn’t disappear :)

Thanks for finding this out … !!!

Reply

ketsugi (5 comments.) on January 24, 2007 at 4:13 am.

It’s worth noting that the tag resetting issue also occurs whenever a post receives a pingback or trackback. I reported this issue to Christine a while back, hopefully she can push out a more comprehensive fix for it soon.

Reply

jorge (1 comments.) on January 24, 2007 at 6:40 am.

odd, the tag reset bug doesn’t seem to have any effect on my install. what version of UTW are we talking about here?

Reply

Andrew (1 comments.) on January 24, 2007 at 1:46 pm.

Damn, I hadn’t spotted the tag deletion problem – thanks for this post!

Reply

moeffju (1 comments.) on January 24, 2007 at 2:20 pm.

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.

Reply

Collin (15 comments.) on January 24, 2007 at 5:36 pm.

Donncha – do you know if anyone has told Christine?

Reply

ketsugi (5 comments.) on January 24, 2007 at 7:59 pm.

Collin, see my comment above.

Reply

HandySolo (4 comments.) on January 25, 2007 at 3:09 am.

Awesome — great stuff, folks!

Maybe tonight I upgrade. :-)

Reply

Everton (1 comments.) on January 25, 2007 at 1:33 pm.

I’m not seeing this problem either on two upgraded blogs

Reply

Kirk M (1 comments.) on January 28, 2007 at 9:41 pm.

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

Reply

HandySolo (4 comments.) on January 30, 2007 at 3:37 am.

Doh. I future-posted an article today. It showed up without tags (fix above applied). Watch for that.

Reply

Zeke W (1 comments.) on March 1, 2007 at 11:34 pm.

THANK YOU. I noticed tags disappearing a few days ago, but couldn’t even figure out why it was happening.

Reply

raimundoz (1 comments.) on March 20, 2007 at 9:00 pm.

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?
thanks

Reply

paul (8 comments.) on July 19, 2007 at 4:05 pm.

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 ! :D

Reply

paul (8 comments.) on July 20, 2007 at 3:28 pm.

I’ve been having the same problem as HandySolo when testing the post-in-the-future option. Does anyone have an idea about what’s going wrong ?

Reply

Cole (1 comments.) on September 8, 2011 at 11:03 am.

Im still using that version of WP, so this fix is useful for me

Reply

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

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


Holy Shmoly! is Stephen Fry proof thanks to caching by WP Super Cache