Answer the question
In order to leave comments, you need to log in
How to change the letter through hook for Contact Form 7?
I'm using this hook right now:
add_filter( 'wpcf7_validate_textarea', 'custom_textarea_validation_filter', 20, 2 );
add_filter( 'wpcf7_validate_textarea*', 'custom_textarea_validation_filter', 20, 2 );
function custom_textarea_validation_filter( $result, $tag ) {
if ( 'your-message' == $tag->name ) {
$your_message = isset( $_POST['your-message'] ) ? trim( $_POST['your-message'] ) : '';
if ( strpos($your_message, 'http://') !== false ) {
$result->invalidate( $tag, "Incorrect value" );
}
}
return $result;
}
$result->invalidate( $tag, "Incorrect value" );
Answer the question
In order to leave comments, you need to log in
I'm using this hook right now:
add_filter('wpcf7_posted_data', 'my_wpcf7_posted_data');
function my_wpcf7_posted_data($posted_data) {
if (isset($posted_data['your-message']) && strpos($posted_data['your-message'], 'http://') !== false) {
$posted_data['your-message'] = 'Мой текст';
}
return $posted_data;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question