Skip to content

Instantly share code, notes, and snippets.

@richardW8k
Last active December 31, 2015 08:38
Show Gist options
  • Save richardW8k/7961308 to your computer and use it in GitHub Desktop.
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
// 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