Ultimate Tag Warrior Breaks WordPress Search

A couple months ago, I followed JS’s excellent instructions for doing some search engine optimization (SEO) on http://lesia.com. If you are a WordPress user or have followed similar instructions, you may have stumbled upon the Ultimate Tag Warrior (UTW) plug-in that adds further SEO features to WordPress-based blogs. UTW is great for what it does but recent releases of the plug-in contain a pretty nasty bug that remains unfixed. UTW breaks the WordPress built-in blog search feature.

To fix the bug, change line 849 in wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php as follows:


$join .= ” LEFT JOIN $tablepost2tag p2t on $wpdb->posts.ID = p2t.post_id INNER JOIN $tabletags on p2t.tag_id = $tabletags.tag_id “;



$join .= ” LEFT OUTER JOIN $tablepost2tag p2t on $wpdb->posts.ID = p2t.post_id LEFT OUTER JOIN $tabletags on p2t.tag_id = $tabletags.tag_id “;

I hit this bug today after noticing the search functionality on my blog was broken. Typing ‘barcelona’ in the search box on the left and clicking the button should return at least 4 posts I have written containing Barcelona. Instead, only one post, the one I wrote about Sweden & Italy today, was being returned. I did a couple more searches and saw a pattern. Only posts I have added those fancy tags to (at the bottom) were being returned. Posts I haven’t tagged weren’t being returned even if they contained the search string.

That helped me narrow the bug to something dealing with tagging. I reviewed my database entries to make sure the data was being saved appropriately. I then moved on to the code dealing with searching posts (the ‘posts_where’ filter). UTW is the only WordPress add-on in my configuration that manipulates the built-in search so I figured it was the culprit. I looked through the code to see how its posts_where filter was being performed. Sure enough, my limited Structured Query Language (SQL) knowledge was adequate to see the query mentioned above was written in a way that assumes all posts have been tagged.

I made the 3 SQL keyword changes, uploaded the fix to my server and voila. My blog search works again.

Of course, after doing this troubleshooting myself, a quick Internet search for “Ultimate Tag Warrior breaks search” returned this post as the first result. Of course you have to know the problem is with UTW to perform that search. Further, that post doesn’t explain the bug or how to fix it and the forum post it mentions contains mixed information. So my time was not completely wasted and I figured I would write this to hopefully save other WordPress & UTW users some time.

JS releases TightBrain.com

Long-time friend and technophile, JS, started a new blog TightBrain.com where he bestows his insight and advice on the latest developments in the high-tech arena. I have been telling JS he should start a blog for years. It is great to see he is up and running in a very big way.

Go check him out.

[tags]tightbrain.com, friends, blog[/tags]