Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've received an old wordpress 2.8 and successfully upgraded to WP3.2.1. I've just discovered that the amount of comments displayed in the WP Admin 's list of posts is wrong.

Would you know how i could fix that by, perhaps, running a clever SQL update query in the database, that would fetch the real number of comments associated to a post and update the post row accordingly?

share|improve this question

1 Answer 1

I nailed it:

UPDATE wp_posts as p SET comment_count =(SELECT count(*) FROM `wp_comments` WHERE `comment_post_ID`=p.ID);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.