wpcf7_captcha_validation_filter()CF7 1.0

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpcf7_captcha_validation_filter( $result, $tag );
$result (обязательный)
-
$tag (обязательный)
-

Код wpcf7_captcha_validation_filter() CF7 5.9.3

function wpcf7_captcha_validation_filter( $result, $tag ) {
	$type = $tag->type;
	$name = $tag->name;

	$captchac = '_wpcf7_captcha_challenge_' . $name;

	$prefix = (string) ( $_POST[$captchac] ?? '' );
	$response = (string) ( $_POST[$name] ?? '' );
	$response = wpcf7_canonicalize( $response );

	if ( 0 === strlen( $prefix )
	or ! wpcf7_check_captcha( $prefix, $response ) ) {
		$result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) );
	}

	if ( 0 !== strlen( $prefix ) ) {
		wpcf7_remove_captcha( $prefix );
	}

	return $result;
}