I was having some problems with my keywords getting deleted when updating a post (using Jerome’s Keywords 1.8). The problem was a result of a blank textarea on the page to edit a post. Wasn’t hard to fix at all.
The textarea, with a header of “Keywords”, shows up blank when editing a post. The initial post is good because that text area is filled out manually. jeromes-keywords.php was using “$postdata->ID” as a reference in the get_post_meta() function. $postdata->ID didn’t contain any value at all.
After doing a little digging, I found I could get a posts ID using $post->ID, notice the missing “data”. It only takes a few steps to get Jerome’s Keywords working 100% in WordPress 2.0.
1. Open wp-content/plugins/jeromes-keywords.php in a text editor.
2. On line 553, change the line that says “global $postdata, $content” to read “global $post, $content”.
3. On line 555, change “get_post_meta($postdata->ID, KEYWORDS_META, true)” to “get_post_meta($post->ID, KEYWORDS_META, true)”.
4. Save jeromes-keywords.php, you’re done.
After doing that, the keywords textarea created by the plugin will be populated with your original keywords. I guess that textarea must have the keywords there all the time, even when editing. Before, my keywords weren’t in the “keywords” textarea, they were only in a custom field.
It appears that Jerome’s Keywords deletes post meta every time that post is edited. And I think that’s the desired functionality for some reason. I only say that after looking at the code for a half hour or so. I think the post would end up with one custom field named “keywords” for every time the post is edited or updated. So, update a post 4 times and you’ll have 4 identical custom fields named “keywords”.
All of my favorite plugins are now working very well for me with WordPress 2.0-RC1.