Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook prevents validation on a reCaptcha field by indicating that it is hidden on the page.
Usage
add_filter( 'frm_is_field_hidden', 'mark_recaptcha_hidden', 20, 3 );
Parameters
- $hidden (boolean)
- $field (object)
- $values (array) The POSTed form values
Examples
Don't validate reCaptcha during API request
add_filter( 'frm_is_field_hidden', 'mark_recaptcha_hidden', 20, 2 );
function mark_recaptcha_hidden( $hidden, $field ) {
$is_api_request = defined( 'REST_REQUEST' ) && REST_REQUEST;
if ( FrmField::is_field_type( $field, 'captcha' ) && $is_api_request ) {
$hidden = true;
}
return $hidden;
}