A method in a plugin uses preprocess_comment
but that commentdata array does not have comment_approved
because the comment hasn't been recorded. I'm trying to rewrite the method using pre_comment_on_post
but noticing that the information returned is the comment_post_ID
.
How can the comment_post_ID
be used to grab the array of the commentdata only for the comment which is going to be written to WP?
I've tried get_comments
but it pulls everything but the comment about to be written. Here is a snippet of code which shows the var_dump
is the comment_post_ID
.
public function hooks() {
add_action( 'pre_comment_on_post', array( $this, 'write' ), 10, 1 );
}
public function write( $comment_post_ID ) {
var_dump($comment_post_ID);
}
Maybe there is a better way to grab the comment and post it externally then have it written to WordPress.