Tags working better now

I noticed that the links for the tags (to view all posts with the same tag) weren’t working. So after a while of messing around trying to install/activate mod_rewrite on my Apache server, physician I gave up (because I think you must need to have it active when you install WP originally?). Anywho… I just hacked up Ultimate Tag Warrior to work without the mod_rewrite (just uses the URI like every other page now). Then I customized it a little more to my current theme, psychiatrist and I noticed that the Popular tags on the right side of the screen were not counting above 1. This is just an error in Ultimate Tag Warrior.

If you have a similar problem, go to the file “wp-content/plugins/ultimate-tag-warrior.php” and look at the function that starts:

function ultimate_show_popular_tags($limit = 10)
To get this to work at all, I had to change the first line to three lines:

global $wpdb, $tabletags, $table_prefix;
$tabletags = $table_prefix . 'tags';
$tableP2T = $table_prefix . 'post2tag';

then there WAS the query:

$query = "select tag, count(tag) as count
from $tabletags
group by tag
order by count desc
limit $limit";

but that was very wrong. The table it is trying to get a count from only has one reference to each tag. Anywho, you’ll want to either delete this query or comment it out. Then put this query in its place:

$query = "SELECT $tabletags.tag, count($tableP2T.tag_id) AS count
from $tabletags, $tableP2T
WHERE $tabletags.ID = $tableP2T.tag_id
GROUP BY $tableP2T.tag_id
ORDER BY count DESC
LIMIT $limit";

That’s money. Now the popular tags thing should work. Just thought I’d throw that out there in case anyone else had a similar problem. Oh em eff gee, it’s almost 9:00am… I had better get to sleep.

2 thoughts on “Tags working better now

  1. I’ve just grabbed the latest version of UTW (3.0.1 I believe) and it seems to fix the above problem, as well as a few other small bugs. The format has changed a bit, but it supports legacy code through a legacy interface.

    You wouldn’t happen to know of any way to fix the mod_rewrite problem, would you?

Leave a Reply

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