Skip to main content

Filters

FilterParametersReturns
google_invre_is_valid_request_filter$isValidbool. Whether the request is considered validated.
google_invre_language_code_filter$languageCodeThe language code of the badge and challenge.
google_invre_badge_position_filter$positionbottomright, bottomleft or inline.
google_invre_is_gf_excluded$isExcluded, $formIdbool. Whether a Gravity Form is skipped.
google_invre_ajax_submit_classnames$classNamesArray of submit button class names used by AJAX forms.

google_invre_is_valid_request_filter​

Filters the result of reCAPTCHA token verification in the current request. Return true if the token should be considered validated, and false if the token is missing or not approved.

add_filter( 'google_invre_is_valid_request_filter', function ( $isValid ) {
return false; // always reject the result
} );

google_invre_language_code_filter​

Changes the language of the badge and challenge. It overrides the setting. The code must be on the list in the Language setting, for example fr, de or pt-BR. Other codes are ignored and Google picks the language.

add_filter( 'google_invre_language_code_filter', function ( $languageCode ) {
return 'fr';
} );

Google's list: reCAPTCHA language codes.

google_invre_badge_position_filter​

Changes the badge position. It overrides the setting. Allowed values: bottomright, bottomleft, inline. Anything else becomes bottomright.

add_filter( 'google_invre_badge_position_filter', function ( $position ) {
return 'bottomleft';
} );

google_invre_is_gf_excluded​

Decides whether a Gravity Form is left unprotected. $isExcluded is true if the form ID is in the Excluded Gravity Forms IDs setting.

// Never protect form 12.
add_filter( 'google_invre_is_gf_excluded', function ( $isExcluded, $formId ) {
return $isExcluded || 12 === $formId;
}, 10, 2 );

google_invre_ajax_submit_classnames​

The class names of submit buttons that the plugin treats as AJAX submit buttons. Default: wpcf7-submit and invisible-recaptcha-do-submit. Write the names without a dot.

add_filter( 'google_invre_ajax_submit_classnames', function ( $classNames ) {
$classNames[] = 'my-form-submit';
return $classNames;
} );

INVISIBLE_RECAPTCHA_OVERRIDE​

A constant, not a filter. Set it in wp-config.php to true or false to force the result of every check, whatever Google says.

define( 'INVISIBLE_RECAPTCHA_OVERRIDE', true );
caution

With true, every form passes and spam is no longer blocked. Use it only to test, or to get past a problem while you fix your keys. Remove it afterwards. With false, every check fails, including your login. Values that are not true or false are ignored.