Title: submitted comment not increasing comment_count
Last modified: August 19, 2016

---

# submitted comment not increasing comment_count

 *  [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * (@shatterjack)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/submitted-comment-not-increasing-comment_count/)
 * I am using INSERT_INTO to put my comments into my database. The comment_content,
   comment_author, and comment_post_ID get inserted into the database but the comment_count
   for the post doesn’t increase automatically. Do I have to do it manually? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * (@shatterjack)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/submitted-comment-not-increasing-comment_count/#post-1369573)
 * does anyone know how comment_count gets its value?
 *  Thread Starter [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * (@shatterjack)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/submitted-comment-not-increasing-comment_count/#post-1369641)
 * I’ve tried doing an INSERT to add the new comment, and an UPDATE to update the
   comment_count:
 *     ```
       mysql_query ("INSERT INTO wp_comments(comment_content, comment_author, comment_post_ID) VALUES ('$_POST[commenty]', '$_POST[author]', '$_POST[number_of_the_post]')");
                           mysql_query ("UPDATE wp_posts SET comment_count=comment_count+1 WHERE comment_post_ID = '$_POST[number_of_the_post]'");
       ```
   
 * The comment gets added but the comment_count doesn’t increase…
 *  Thread Starter [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * (@shatterjack)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/submitted-comment-not-increasing-comment_count/#post-1369676)
 * when there is an unapproved comment and I approve it in the dashboard, it updates
   the comment_count automatically for that post, but then if I post to it while
   I am logged in, it does not update it. What am I doing wrong with that code above?
   Thanks…

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘submitted comment not increasing comment_count’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 1 participant
 * Last reply from: [shatterjack](https://wordpress.org/support/users/shatterjack/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/submitted-comment-not-increasing-comment_count/#post-1369676)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
