gform_recaptcha_spam_score_threshold

Description

This gform_recaptcha_spam_score_threshold filter allows control over the spam score threshold used by the reCAPTCHA Add-On.

Usage

Applies to all forms.

add_filter( 'gform_recaptcha_spam_score_threshold', 'your_function_name', 10, 2 );

Applies to a specific form. Replace {FORMID} with your Form ID.

add_filter( 'gform_recaptcha_spam_score_threshold_{FORMID}', 'your_function_name', 10, 2 );

Parameters

NameTypeDescription
$thresholdfloatThe spam score threshold used to determine whether a submission is considered spam.
$formarrayThe form currently being processed.

Examples

Apply a custom spam score threshold for form ID 4.

add_filter( 'gform_recaptcha_spam_score_threshold_4', function( $threshold, $form ) {
	return 0.8;
}, 10, 2 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in reCAPTCHA Add-On 2.1

Source Code

This filter is located in class-gf-recaptcha.php