Support » Plugins » wp-comments-post.php — getting new comment ID

  • blakekr


    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);
    $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.