WordPress Negative Comment Count

Uncategorized — Titus Barik on November 26, 2007 at 7:47 pm

I noticed that a lot of my older posts had a comment count of one, even though there were no comments associated with that post in the database. On closer inspection, I found that the comment_count field in WordPress for table wp_posts actually had negative numbers for these very posts. I have no idea how this transpired, but it was easily fixed with the following query:

UPDATE wp_posts SET comment_count = 0 
WHERE comment_count < 0

Update: Of course, I now have incorrect comment counts on certain posts, so I need to find a fix for this as well.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

titus@barik.net | The Weblog of Titus Barik