Don't Email Submissions of Certain Contact Form 7 Forms
Stops Contact Form 7 sending emails for the forms you list while still showing the success message, useful when submissions are saved or sent to a CRM instead.
Opens WPIDE on
Code
$wpide_cf7_no_mail_forms = array(); // Form IDs that should not send email, e.g. array( 123, 456 ).
add_filter( 'wpcf7_skip_mail', function ( $skip, $contact_form = null ) use ( $wpide_cf7_no_mail_forms ) {
if ( $contact_form && in_array( (int) $contact_form->id(), array_map( 'intval', $wpide_cf7_no_mail_forms ), true ) ) {
return true;
}
return $skip;
}, 10, 2 );
Notes
Add the form IDs at the top and pair it with a snippet that saves submissions or sends them to a webhook, otherwise the messages are lost.
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.