Hi, i solved this issue by using below code in path:- ../plugins/contat-form-c7/modules/textarea.php file instead of validation filter.
code as follows:-
// Contact form 7 custom validation for spam in message lines
add_filter( ‘wpcf7_validate_textarea’, ‘custom_text_confirmation_validation_filter’, 10, 2 );
add_filter( ‘wpcf7_validate_textarea*’, ‘custom_text_confirmation_validation_filter’, 10, 2 );
function custom_text_confirmation_validation_filter( $result, $tag ) {
// Add your spam words below, separated by ‘,’
$bads = array(“seo”,”advertisement”,”advertise”,’SEO’,’ADVERTISEMENT’,’ADVERTISE’);
// Specify the name of the Contact Form 7 field that you want to check for spam
$filter_field = “your-message”;
if ( $filter_field == $tag->name) {
$your_subject = isset( $_POST[$filter_field] ) ?
trim( $_POST[$filter_field] ) : ”;
foreach($bads as $a) {
$a=preg_quote($a,’\\’);
if(preg_match(“/$a/”,$your_subject)) {
$result->invalidate( $tag,’Please do not spam this contact form.’);
}
}
}
return $result;
}