Chip's Tips for Developers

Contains coding, but not narcotic.

Correction for Jerome’s Keywords plugin for WordPress

July 14th, 2006 8:31:34 am pst by Sterling Camden

I use the Jerome’s Keywords plugin for WordPress to do tagging on my blogs. I love it, but it has one problem: if you search on a tag that is contained within another tag, you get the aggregate results of both tags. That’s because Jerome uses a SQL WHERE clause containing LIKE ‘%keyword%’ to match tags that are in a comma-delimited list in the metadata value field.

I left a comment on Jerome’s blog about this issue, but it looks like it never even made it past moderation. In fact, no new comments on this post since May. Where’s Jerome?

I mentioned this problem to Johannes Jarolim, author of the Jerome’s Keywords Manager plugin. Johannes came up with the correct WHERE sub-clause (value LIKE ‘keyword,%’ OR value LIKE ‘%,keyword’ OR value LIKE ‘%,keyword,%’ OR value = ‘keyword’) and implemented that in his plugin. But alas, that did not help my widget, which relies on the ?tag=keyword link operation provided by Jerome.

So, I felt like my best alternative would be to correct Jerome’s plugin and post it here. If Jerome adopts this correction (or something equivalent) and lets me know about it, I’ll take down this download and point over to his site instead.

UPDATE: I made yet another correction to this plugin, so head on over here for the latest and greatest.

UPDATE: Jerome released a 2.0 beta of the plugin that corrects this problem. Get the whole scoop.

Posted in PHP, SQL, Wildly popular, WordPress | 12 Comments » RSS 2.0 | Sphere it!

12 Responses to “Correction for Jerome’s Keywords plugin for WordPress”

  1. [...] Comments Tag — you’re it, Jerome! — Chip’s Quips on Tagnificent plugin for WordPressCorrection for Jerome’s Keywords plugin for WordPress –Chip’s Tips for Developers on Tagnificent plugin for WordPresssterling on Guten Tag, Johannes!Johannes Jarolim on Guten Tag, Johannes!Johannes Jarolim on Guten Tag, Johannes! Post Stats [...]

  2. [...] My tag cloud widget for WordPress continues to be popular, closing in on 200 downloads. Today I noticed a Greek blog using it. In terms of small and flat, I think the world is down to a dime now. Hey, Nikos — make sure you get the correction for Jerome’s Keywords, too. [...]

  3. Mike says:

    Chip,

    I using your 2.0 version of JK and am getting the following error when one of the keywords uses an ‘ (apostrophe) in the keyword. In this case Wilson’s Creek.

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Creek' OR jkeywords_meta.meta_value LIKE 'Wilson's Creek,%' OR jkeywords_meta.' at line 1]
    SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_postmeta AS jkeywords_meta ON (wp_posts.ID = jkeywords_meta.post_id) WHERE 1=1 AND post_date_gmt

  4. Mike, ouch! I think the single quote may be throwing a monkey-wrench into the works. I’ll habe to look into this tomorrow when I haven’t had so much wine to drink. Get back to you soon.

  5. [...] Recent Comments Sterling Camden on Correction for Jerome’s Keywords plugin for WordPressMike on Correction for Jerome’s Keywords plugin for WordPressMike on Correction for Jerome’s Keywords plugin for WordPressHave some class and shut it — Chip’s Quips on Disable/enable double-click on Synergy lists in Windows.Sterling Camden on Sorting ActiveX lists by column Post Stats [...]

  6. Mike, does Jerome’s version 2.0 beta take care of the problem?

  7. Mike says:

    So far so good. I’ve tested the single quotes using the cloud tag (Wilson’s Creek) and also as a URI, http://www.mydomain.tld/tag/single‘s+quote and eveything looks great. I’m going to give the new Tag Cloud widget a shot next.

    Mike

  8. Very cool, Mike. Hope that all continues to work well for you.

  9. Saul says:

    What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

  10. See my answer to the same (identical) question here.

  11. [...] Fix for tag lookup with Jerome’s Keywords plugin – Instead of finding all posts which has a tag that matches the beginning of the tag being looked up, then it only finds posts with exact tag match. [...]

Leave a Reply

Better Tag Cloud