AnsPress_Comment_Hooks::preprocess_comment( array $commentdata )
Description #
Change comment_type while adding comments for question or answer.
Parameters #
- $commentdataarray (Required) Comment data array.
Source #
File: includes/comments.php
public static function preprocess_comment( $commentdata ) {
if ( ! empty( $commentdata['comment_post_ID'] ) ) {
$post_type = get_post_type( $commentdata['comment_post_ID'] );
if ( in_array( $post_type, array( 'question', 'answer' ), true ) ) {
$commentdata['comment_type'] = 'anspress';
}
}
return $commentdata;
}
Expand full source code Collapse full source code View on GitHub: includes/comments.php:185
Add your comment