Skip to content

Commit

Permalink
Better comment type handling (#565)
Browse files Browse the repository at this point in the history
* Process WooCommerce reviews

* Allow filtering processable comment types

* Cast comment type filter to array
  • Loading branch information
MatzeKitt authored Feb 4, 2024
1 parent e475355 commit bca8a41
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Handlers/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ function () {
}

public static function process( $comment ) {
if ( ! ContentTypeHelper::reaction_is_one_of( $comment, [ 'comment', '' ], 'comment' ) ) {
/**
* Filter processable comment types.
*
* @param array $types List of comment types
*/
$comment_types = (array) apply_filters( 'antispam_bee_comment_types', [ '', 'comment', 'review' ] );

if ( ! ContentTypeHelper::reaction_is_one_of( $comment, $comment_types, 'comment' ) ) {
return $comment;
}

Expand Down

0 comments on commit bca8a41

Please sign in to comment.