Last active
December 31, 2015 08:38
-
-
Save richardW8k/7961308 to your computer and use it in GitHub Desktop.
Log Gravity Forms validation errors by adding the following code to your theme's functions.php file
This file contains 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
// log field validation errors | |
add_filter( 'gform_validation', 'log_validation_failure', 30 ); | |
function log_validation_failure( $validation_result ) { | |
$form = $validation_result['form']; | |
foreach ( $form['fields'] as &$field ) { | |
if ( $field['failed_validation'] ) | |
GFCommon::log_error( "form #{$form["id"]}: validate() - failed: {$field["label"]}({$field["id"]} - {$field["type"]}) - message: {$field["validation_message"]}" ); | |
} | |
return $validation_result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment