Title: wp-comments-post.php &#8212; getting new comment ID
Last modified: August 18, 2016

---

# wp-comments-post.php — getting new comment ID

 *  [blakekr](https://wordpress.org/support/users/blakekr/)
 * (@blakekr)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/wp-comments-postphp-getting-new-comment-id/)
 * If this post has the air of someone over their head, well, you read it right.
   😉
 * I’m mucking around in wp-comments-post.php, and trying to get the ID of the brand-
   new comment in order to send it to one of my little custom scripts. I have found
   some people apparently managing this by using:
 * $comment_ID = wp_new_comment($commentdata);
    or $comment_ID = (int)wp_new_comment(
   $commentdata);
 * But when I try this in wp-comments-post.php I get the value “1”, presumably to
   say “comment successfully inserted” rather than the comment ID.
 * Does anyone know a sensible way of trying to get this ID out of one of the comments
   php scripts, since if I just muddle through this on my own I will make it WAY
   more complicated than it should be.
 * I appreciate it …

The topic ‘wp-comments-post.php — getting new comment ID’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)

 * 0 replies
 * 1 participant
 * Last reply from: [blakekr](https://wordpress.org/support/users/blakekr/)
 * Last activity: [18 years, 8 months ago](https://wordpress.org/support/topic/wp-comments-postphp-getting-new-comment-id/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
