lewiz.org post comment count (fixing Wordpress wp_hashcash)
I finally got around to upgrading my blog to the latest and greatest version of WordPress… 2.2 right now.
At the same time I switched away from the WordPress HashCash plugin I was using to prevent comment spam. It’s actually done me pretty well over the last year or so. I do get the odd spam comment, but nothing is perfect.
Where wp-hashcash has failed me though is in keeping the comment count associated with each blog post up-to-date. For example, five minutes ago WordPress thought somebody had left a comment on my post about a new keyboard… I believe this to be a side effect of rejected spam comments.
Here’s a quick fix for the problem:
update posts set comment_count=(select count(*) from comments where comment_post_id=id);
Very quick, very simple. Amazingly the stats on my WordPress database were not all that encouraging:
Query OK, 395 rows affected (0.06 sec)
Rows matched: 926 Changed: 395 Warnings: 0
So 395 of my blog posts had the wrong comment count… ouch!
Tags: Website
February 6th, 2008 at 11:40 pm
I have been a frequent visitor of this blog for some time now, so I thought it would be a good idea to leave you with my thanks.
Regards,
Jim Mirkalami
May 23rd, 2008 at 9:35 am
At newest version of WP this plugins have the same problem . Beware.