Hey @bink19th – Thanks for contacting us!
I looked into the code, and it does appear that the code won’t accept different languages or special characters (the period in front of the test). I’ve reported this issue to our developer documentation team and I’ll circle back when the fix is ready.
In the meantime, if you have any other questions, please feel free to reach out.
Kindly,
Hey @bink19th – Thanks for the patience!
When you get a chance, please use following code snippet and that should fix the issue you’re facing:
function wpf_dev_profanity_filter_paragraph( $field_id, $field_submit, $form_data ) {
// Create your list of profanity words separated by commas
$blocked_words = array(
'.test',
'test',
'тест',
);
foreach( $blocked_words as $word ) {
if(strpos($field_submit, $word) !== FALSE ) {
wpforms()->process->errors[ $form_data[ 'id' ] ][ $field_id ] = esc_html__( 'No profanity allowed.', 'plugin-domain' );
return;
}
}
}
add_action( 'wpforms_process_validate_textarea', 'wpf_dev_profanity_filter_paragraph', 10, 3 );
In case it helps, here’s our tutorial with the most common ways to add custom code like this.
For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin.
Kindly,
Hey @bink19th – We haven’t heard back from you in about 3 days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.
Thanks!
-
This reply was modified 3 years, 8 months ago by
Prashant Rai.
-
This reply was modified 3 years, 8 months ago by
Prashant Rai.
Thread Starter
Bink
(@bink19th)
Thank you @prashantrai, your assistance with this is much appreciated. I’ll test out the snippet you’ve provided.
Thread Starter
Bink
(@bink19th)
That’s working well in my testing @prashantrai. Thanks again!
Hey @bink19th – Thrilled to hear that the code is working well for you. If you have any other questions, please feel free to reach out.
Kindly,