Set Minimal Comment Limit

add_filter( 'preprocess_comment', 'minimal_comment_length' );

function minimal_comment_length( $commentdata ) {
	$minimalCommentLength = 20;

	if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ) 
        {
		wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
        }
	return $commentdata;
}

Leave a Reply

Your email address will not be published. Required fields are marked *