Friendlier Contact Form 7 Response Messages
Replaces the standard Contact Form 7 success, error and spam messages on every form with your own wording in one place.
Opens WPIDE on
Code
// CF7 message name => your text.
$wpide_cf7_messages = array(
'mail_sent_ok' => 'Thanks! Your message is on its way and we usually reply within one working day.',
'mail_sent_ng' => 'Sorry, something went wrong sending your message. Please try again or email us directly.',
'validation_error' => 'Please check the highlighted fields and try again.',
'spam' => 'Your message could not be sent. If you are a real person, please email us directly.',
'invalid_required' => 'This field is required.',
);
add_filter( 'wpcf7_display_message', function ( $message, $status = '' ) use ( $wpide_cf7_messages ) {
return isset( $wpide_cf7_messages[ $status ] ) ? $wpide_cf7_messages[ $status ] : $message;
}, 10, 2 );
Notes
Keys are CF7 message names (mail_sent_ok, mail_sent_ng, validation_error, spam, accept_terms, invalid_required); remove a line to keep the form's own text.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.