Created
October 24, 2019 09:36
-
-
Save matthiaspabst/d6da01ab6755fdce06201f60c9eda9ac to your computer and use it in GitHub Desktop.
Gravity Forms Antispam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://pabstwp.de/blog/gravity-forms-antispam-massnahmen-fuer-formulare/