Ultimate Tag Warrior and Atom 1.0

If you’re using the latest bleeding-edge SVN version of WordPress with Ultimate Tag Warrior, check your feed’s validity. WordPress is finally getting around to implementing Atom 1.0 instead of sticking with the comparatively ancient Atom 0.3 (even the validator’s support is deprecated).

Unfortunately, due to the way WordPress and UTW work, UTW doesn’t have a way to really know what kind of feed is requested — the hook it registers is called the_category_rss, and it’s called with a parameter that’s either ‘rdf’, ‘rss’, and sometimes blank.

Even more unfortunate is that the_category_rss is called when an Atom feed is requested. UTW happily inserts the hardcoded <dc:subject> tags into the feed, and since that’s been superseded by <category> in Atom 1.0, and WordPress doesn’t declare the Dublin Core namespace anymore, your feed has just become invalid. Fix after the jump.

To fix, open ultimate-tag-warrior-actions.php in your UTW directory, search for dc:subject, and change ultimate_add_tags_to_rss like this:

Replace the line inside the foreach that starts with $the_list with:

$the_list .= "\n\t<category term=\"". $category->cat_name . "\" />";

And replace the line starting with $format, after the foreach, with:

$format="<category term=\"%tagdisplay%\" />";

This is gonna break your RSS/RDF feed, but you should’ve switched over to Atom anyway, right?

It’s also pretty hacky to even build an XML document by string concatenation, but that’s not easily fixed. Don’t use characters in your tag names that would invalidate your XML, ok?