WordPress.org

Ready to get started?Download WordPress

Forums

wp-comments-post.php -- getting new comment ID (1 post)

  1. blakekr
    Member
    Posted 6 years ago #

    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 ...

Topic Closed

This topic has been closed to new replies.

About this Topic