Checks whether a comment passes internal checks to be allowed to add.

If comment moderation is set in the administration, then all comments, regardless of their type and whitelist will be set to false. If the number of links exceeds the amount in the administration, then the check fails. If any of the parameter contents match the blacklist of words, then the check fails.

If the number of links exceeds the amount in the administration, then the check fails. If any of the parameter contents match the blacklist of words, then the check fails.

If the comment author was approved before, then the comment is automatically whitelisted.

If none of the checks fail, then the failback is to set the check to pass (return true).

Signature

check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type )
author
 (string) Comment Author's name
email
 (string) Comment Author's email
url
 (string) Comment Author's URL
comment
 (string) Comment contents
user_ip
 (string) Comment Author's IP address
user_agent
 (string) Comment Author's User Agent
comment_type
 (string) Comment type, either user submitted comment, trackback, or pingback

Return

(boolean) Whether the checks passed (true) and the comments should be displayed or set to moderated

Source

function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
	global $wpdb;

	if ( 1 == get_option('comment_moderation') )
		return false; // If moderation is set to manual

	/** This filter is documented in wp-includes/comment-template.php */
	$comment = apply_filters( 'comment_text', $comment );

	// Check # of external links
	if ( $max_links = get_option( 'comment_max_links' ) ) {
		$num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out );
		/**
		 * Filter the maximum number of links allowed in a comment.
		 *
		 * @since 3.0.0
		 *
		 * @param int    $num_links The number of links allowed.
		 * @param string $url       Comment author's URL. Included in allowed links total.
		 */
46 more lines...
WP Trac GitHub

Link here