Not so ultimate WordPress 2.2 tags

45 Comments

Update: I forgot to mention that you must hack a core file and adapt your theme, too. See the end of the article.

Upgrading to WordPress 2.2 bleeding edge is an adventure, always. Not necessarily because they introduce new bugs--it's the new features that are sometimes worrying. When one svn up changed all the feeds from somewhat-valid RSS to invalid Atom, I didn't complain because, hey, it's the bleeding edge, and Atom is so much better anyway. I just fixed the bug, and it was good. (In retrospect, I should have sent a patch. I forgot.)

Having tagging functionality in the WordPress core is a good idea, too. In general. Basically. However, if there already exists a widely-deployed tagging plugin--and for WordPress, one very much does exist--it may be a good idea to look at the functionality and semantics of the existing plugin before reinventing the wheel, badly.

UTW has a function named is_tag(). WordPress 2.2 adds a function of the same name. Ergo, things break. Renaming the plugin dir helps, but your tags are gone. Re-activating the plugin shows you the shiny new plugin sandboxing (which, btw, Habari started in January), but doesn't bring you back your tags.

Some searching might point you to the UTW tags importer (Options > Import > UTW). After a funny message about deleting unwanted tags from the UTW management page (hey, no plugin, no options page, okay?), the import kinda works. The "Did we say 5 steps? We meant 4. Ha ha ha." joke is getting pretty old pretty fast, though. Then, instead of the UTW_ShowTagsForCurrentPost() function, you use the_tags() in your template. Of course, the semantics of the_tags() are slightly different from those of the_category(), and completely unlike the old UTW functions semantics.

So I decided to get UTW back. Despite claims to the opposite, the changes required are actually pretty simple: open ultimate-tag-warrior.php and search for occurrences of is_tag(. Replace all occurrences with UTW_is_tag(. Activate the plug-in.

Update: Do the same in your theme - where you use is_tag() now, change it to UTW_is_tag(). Then, open wp-includes/rewrite.php, search for the function get_tag_permastruct, and add return false; directly after the opening brace. (This unbreaks /tag/ pages.)

Done.

Christian Mohn

I had the same problem initially, but I did get UTW working again on SVN Rev. 5213, without any hacking of core UTW or Wordpress files.

Still, I do want to switch over. Why haven't I already?

April 10, 2007 3:55pm

moeffju

Revision 5227 broke UTW (and thus, my site) for me. Prefixing all of UTW's functions is a good idea either way, I think.

April 10, 2007 4:15pm

Christian Mohn

5227? Thats my Norwegian Post Number. :)

Mine broke earlier than that, but was again fixed in 5213. Of course prefixing UTW is a good idea, but given the current state if UTW and WP the best idea would have been for WP to not stomp it's feet on top of the existing UTW plugin, as you said above.

April 10, 2007 4:40pm

WordPress PHP Programming Codescheme.Net » Ultimate Tag Warrior Unbroken

[...] Having upgraded to WordPress 2.2 on 2 other sites and been contacted by precisely 2 unhappy punters complaining about their tags going awry, some searching was in order and I came up this sensible advice on the Ultimate Tag Warrior plugin [...]

April 10, 2007 9:34pm

???? Ultimate Tag Warrior? @ ???????

[...] tag ???????WordPress 2.2 ? tagging ??????????? moeffju ?????? UTW ? WordPress 2.2 [...]

April 11, 2007 5:21am

Owen Kelly

A couple of questions, since you are obviously aware of how tagging works in 2.2, and I am a confirmed UTW user.

  1. Was it easy to switch WP tagging off neatly when you switched back to UTW?

  2. Does WP tagging create tag clouds or do we need a plug-in for that - hohoho ?

April 12, 2007 2:20pm

Christian Mohn

I actually have both enabled now, as far as I can tell the WP tags doesn't really do any technorati integration (i might be wrong though), so I just told UTW to process the tags but not display them in my theme.

I have not seen a built-in tagcloud in the WP tags.

April 12, 2007 3:07pm

moeffju

As far as I could see in my quick run through the code, the wp tagging system does not do any integration or tag clouds. OTOH, if you don't change your theme or just remove the call to the_tags() from your theme, the wp tagging functionality doesn't interfere with anything. It might show up in feeds, but I haven't checked.

I'm back to using exclusively UTW, for the tag clouds, the better UI, and the legacy data.

April 12, 2007 4:06pm

Christian Mohn

Under "import" there is an option to import your UTW tags into WP Tags.

April 12, 2007 6:26pm

moeffju

I know, I mentioned it in the article, but I prefer UTW at least until the WP tagging stuff is mature.

April 12, 2007 6:58pm

Just Thinkin’ » Blog Archive » Wordpress 2.2 has tagging support. Poor UTW

[...] the new WP tagging system breaks the old reliable Ulitmate Tag Warrior plugin and some hacking to UTW is needed to use it once again. I use UTW for the specific purpose of incorporating related posts [...]

April 12, 2007 11:04pm

Looking Forward to Wordpress 2.2? » JaypeeOnline | Blogging News & Reviews

[...] including myself who are using UTW. Fortunately Moeffju has found a way of fixing the issue with a UTW hack. It involves editing the ultimate-tag-warrior.php file with your text editor and replacing all [...]

April 13, 2007 3:12am

Owen Kelly

Okay, thanks. I will make the changes to UTW now - before I upgrade - and I think I will join you in using UTW until WP provides a reason not to.

Which would have to include a quick, easy and foolproof way of gathering up the legacy tags and entering them into the new system.

BTW, if the built-in tag system really does mean we are going to see plug-ins for technorati integration, tag clouds, and so on, then I think it is not really a step forward at all.

April 13, 2007 10:18am

moeffju

Owen, there is an importer for UTW's tags under Options > Import > Ultimate Tag Warrior. However, with no way to get related posts, related tags, a tag cloud etc., the point is moot for me :)

April 13, 2007 12:16pm

  Will WordPress 2.2 kill the UTW plugin? by The Four-eyed Journal

[...] including myself who are using UTW. Fortunately Moeffju has found a way of fixing the issue with a UTW hack. It involves editing the ultimate-tag-warrior.php file with your text editor and replacing all [...]

April 14, 2007 5:45am

tinyau

I'm using SVN r5288. I followed your changes, i.e. change all occurrence of is_tag( to UTW_is_tag( in ultimate-tag-warrior.php. And change the permalink structure of tag to other format to ensure not to conflict with UTW tag search URL.

Tag search (both /tag/tagname or /index.php?tag=tagname) is still can't work properly.

April 20, 2007 5:54am

moeffju

You have to use UTW_is_tag() in the theme, too, where you currently use is_tag. Sorry, I should've made that clear. I'll update the post.

April 20, 2007 11:32am

YILKA

I followed your guide after upgrading to WP 2.2 and UTW now works flawlessly in my blog. Thanks a lot :D

Just a quick note, I also need to modify is_tag() funtion in 'ultimate-tag-warrior-actions.php'

May 16, 2007 7:36pm

Narration

I wonder what else may be conflicting. I've made the UTW_is_tag() mods, but there is a problem with basic Wordpress search.

I can search all posts it seems which were written before the 2.2 upgrade. None written after show up.

I looked at the posts in the database, and can't see anything unusual in the fields of any of the later ones which aren't searched.

There's a similar problem of not searching successfully on pages, enabled by the Search Everything plugin.

All goes back to working normally if I disable UTW in Plugins.

Any ideas?

May 24, 2007 10:37pm

Narration

I guess I'd better say that I didn't find any get_tag_permastruct() in rewrite.php, or anywhere else, to follow your short-sheeting return instruction.

Did you mean some other function name (there are lots of get_xxx_permastruct) to modify, and could that have to do with the search fail on new posts problem?

Also will say for the record that I deactivated all plugins except UTW, for a final check that was what causes the search fault.

Regards, N.

May 24, 2007 10:48pm

Narration

Ok, I have found the fix for this problem. It's in the comments on this page:

http://www.neato.co.nz/forum/comments.php?DiscussionID=1560&page=1#Item_0

The fix is in ultimate-tag-warrior-actions.php. I'd take a safe copy before proceeding. Line numbers also change. Search for the $join and you'll find it in two places. The right place is the second place.

There are more issues with UTW and WP2.2, but this will get your searches properly working - and it is a need for earlier versions of WP also. So maybe this plus the funny issues is what's keeping the Neato forum silent.

May 25, 2007 9:56pm

Crazy Crank

well everybody is shouting about the IMPORT option. damn, i have a german version. and there is no such an option or i'm just to stupid to find it. that's offical wordpress 2.2. can someone send an URL of the import option please? help me please i need to import the tags. the version i'm using is 3.14159265.

May 31, 2007 10:31pm

Christian Mohn

Tags where dropped from the WP2.2 release, you won't see it until 2.3

May 31, 2007 10:34pm

Crazy Crank

oh that's great news. höhö. hust hust. well, then maybe I need to update the function calls only with the latest versionl. but stop, achtung halt! why does my old plugin version with my old database date which was fine for WP 2.05 then re-incarneted with a WP 2.2 codebase and using a simple wp-admin/update.php scriptrun (which works) does not work after.all? if so WP 2.2 has no tags at all??? why does UTW does not work any longer? the old version as well as the new? any help?

I will now replace the function calls to the new UTW_ naming. hope this helps but I bet it won't and all this is broken.

May 31, 2007 10:38pm

Crazy Crank

okay it seems that UTW is just crashed with WP 2.2. punkt. hopefully one of both sides will win - the plugin or wp core. I really liked UTW.

May 31, 2007 11:02pm

jason

There is an easier way. Just call "is_utwtag()" which is built into pi+ versions of UTW. If is_tag() exists, UTW will use is_utwtag(). If not, both is_tag() and is_utwtag() works.

June 3, 2007 5:52am

fabbio

Hi there, was trying to activate the plugin... clean installation, no other plugins installed... wordpress 2.2 - it triggered a fatal error and won't activate...

I read the code a bit...

if(!function_exists('is_tag')) { function is_tag() { return is_utwtag(); } }

shouldn't this sandbox is_tag and make it safe? any chance to get some logs out of wordpress... where? php logs won't help :-(

I didn't insert anything in the theme... so I guess it should be safe

anyone experiencing the same problem?

cheers

June 12, 2007 1:12pm

John

I tried to follow your instructions, but I can't find any .php files in my theme which use is_tag. The theme is Cutline – if anyone is familiar with it then I would appreciate advice. My wp-includes/rewrite.php also does not have the function get_tag_permastruct.

In the end, I went to the UTW options and deactivated 'use URL rewriting'. It seems to work now with no other changes, but of course tag page URLs now end index.php?tag=sometag. I'm not sure whether that matters, but at least the tags are no longer leading to 404s.

June 14, 2007 8:41am

??Ultimate Tag Warrior 3.14159265 ? ??Myheimu

[...] ??????????????UTW3?WP2.2???????????? [...]

June 21, 2007 2:58pm

Brian

same problem here - followed the instructions but some of the code snippets referenced don't exist - hope someone writes a fix for those of us still having this problem

June 30, 2007 12:28am

Jenny

tagging wasn't added in 2.2 official release. if it was i don't see an option for it.

June 30, 2007 6:59am

Michael

I also deactivated ‘use URL rewriting’. The problem I have is that all of my pages with the old tag url are showing in google and lead to a 404 page.

July 4, 2007 1:16pm

Michael

Ok, I've figured out a very simple solution to fix it all.

Go to 'permalinks' in the options menu and 'update permalink structure'. That will fix the problems and you won't have any other issues. Basically you can go back to using URL rewrite and no more 404s :)

July 4, 2007 1:30pm

John

Thanks Michael - I hadn't realised that the old tags would lead to 404s (I'm a bit of a WP newbie). I've just done what you suggested and now it seems to be working perfectly, with the URL rewriting on. I also don't get 404s from the non-rewritten (i.e. index.php?tag=) URLs, so all seems to be good.

July 4, 2007 4:49pm

Michael

John

I've just tried to post a comment on your blog and the comment form takes me through to a duplicate post, its an error of some kind, you might want to take a look.

July 4, 2007 4:56pm

John

Michael

The comment did come through - I have just approved it and will reply to it on my own blog. I'll look into the error message, as it doesn't inspire much confidence. I'm not entirely surprised - updating to 2.2 broke several things (such as the content form, which also seems to clash with UTW). It was my first WP update, so I suppose I'll have to get used to it.

July 4, 2007 6:37pm

Brian

whoa WAIT - people, don't miss michael's post above - if url rewriting isn't working for you, turn it back on and then go to options > permalinks and hit the 'update permalink structure' - it works! Not sure if there is something suboptimal about doing it this way, but at least my /tag/ urls work again - still will be nice when utw is updated to work with wordpress 2.2x, but making that change does seem to fix things well enough ...

July 5, 2007 3:04am

wonderer

maybe someone pointed it out somewhere, anyway, it seems UTW is not working with tags which consist in more than one word. It always leads to NOT FOUND page. i saw it happening in mine and in other blogs. everything works fine when u check single words

how to fix this?

July 14, 2007 2:34am

John

Just checked mine, and UTW is handling the two-word tags just fine.

July 14, 2007 11:08am

wonderer

then i really don't know what to do, i changed template to check if that was the problem, i changed permalink, used normal url, nothing changed, with more than one word it's not working. any idea of what i could try more?

thanks

July 15, 2007 9:35pm

wonderer

i got it working after millions attempts in case someone is wondering how to do, i just pressed the TIDY button

July 17, 2007 10:24am

Klim

Hi, I have the same problem, I'm using WP 2.2.1 and UTW 3.14. Apparently you found a way to make UTW work properly with WP 2.2.1 but I've seen other solutions and I wonder which one is the more appropriate. Maybe you can help me to find out, I don't know any PHP so I'm lost, I want to hack as less as it's possible. Any help is welcome :)

Here are the other solutions besides yours, dunno if they're working tho:

http://quark.qpsmod.net/coding/ultimate-tag-warrior-fix-for-wordpress-221 http://www.neato.co.nz/forum/comments.php?DiscussionID=1560&page=1#Item_0

July 26, 2007 5:07pm

Soruman

Hi, I'm using wordpress multi user instead of basic wordpress for all my blogs. This way I can easily add and mainting subblogs. Yesterday I've downloaded the last stable version of wordpress mu (wordpress-mu-1.2.3) which is based on Wordpress 2.2.1. I had the same problem while activating UTW (fatal error), I tried the changes you mentioned above, but nothing changed for me. If any of you find a fix for mu, I really appreciate if you share it here.

Thanks in advance.

August 4, 2007 12:15am

jameswillisisthebest

This is my first post just saying HI

September 8, 2007 10:05pm

Magazine online

There's a small mistake in your text:

instead of: Options > Import > UTW

it should be Manage > Import > UTW

September 25, 2007 8:50pm

Comments are closed for this post