Fixing Jerome’s Keywords and WordPress 2.1
I'm using the Jerome's Keywords tagging plugin on this site and noticed that all keywords (tags) for a post will go away if I approve its comments. After some search through the code I've found that the plugin is using the "edit_post" hook to update the keywords after you've changed them on the post screen.
The problem is that this hook is also executed when you approve a comment, but since you are not coming from the post form you're not sending any post data (like the keywords) and the plugin assumes that the post has no keywords or you've deleted them. Mark Jaquith wrote about this behavior earlier this year.
To fix this bug, you have to edit the "keywords_update" function (line 614) of the plugin from:
to:
The "isset" checks if the variable "keywords_list" exists and returns true even if it's empty. If you're coming from the post form, it exist and may be empty if you have deleted the keywords. If you're moderating comments, it won't exist and the keywords will not be accidentally updated.
Note: This is for version 1.9 of the plugin.