Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Forms Antispam
<?php
/**
* Gravity Forms Antispam
* Check if field has a predefined value
* https://docs.gravityforms.com/gform_field_validation/#1-number-field-validation
*/
function gf_antispam( $result, $value, $form, $field ) {
if ( $result['is_valid'] && intval( $value ) !== 9 ) {
$result['is_valid'] = false;
$result['message'] = 'Please enter correct value';
}
return $result;
}
// Form ID 2 , Field ID 8
add_filter( 'gform_field_validation_2_8', 'gf_antispam', 10, 4 );
@matthiaspabst

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.