Created
March 7, 2017 13:52
-
-
Save spivurno/f22f2ecc50df836250f1e28cfebb83a6 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Comment Blacklist // Modify the Blacklist Validation Message
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
<?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