Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/f22f2ecc50df836250f1e28cfebb83a6 to your computer and use it in GitHub Desktop.
Save spivurno/f22f2ecc50df836250f1e28cfebb83a6 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Comment Blacklist // Modify the Blacklist Validation Message
<?php
/**
* Gravity Perks // GP Comment Blacklist // Modify the Blacklist Validation Message
* http://gravitywiz.com/documentation/gravity-forms-comment-blacklist/
*/
add_filter( 'gform_validation', function( $result ) {
$my_custom_blacklist_validation_message = 'Blacklisted!';
foreach( $result['form']['fields'] as &$field ) {
if( $field->validation_message == __( 'We\'re sorry, the text you entered for this field contains blacklisted words.', 'gravityperks' ) ) {
$field->validation_message = $my_custom_blacklist_validation_message;
}
}
return $result;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment