I have a plugin I am writing that I want to interact with Contact Form 7. In my plugin I added the following action add_action
add_action(\"wpcf7_before_send
I had to do this to prevent Email from being sent. Hope it helps.
/*
Prevent the email sending step for specific form
*/
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else($cf7) {
// get the contact form object
$wpcf = WPCF7_ContactForm::get_current();
// if you wanna check the ID of the Form $wpcf->id
if (/*Perform check here*/) {
// If you want to skip mailing the data, you can do it...
$wpcf->skip_mail = true;
}
return $wpcf;
}
This code assumes that you are running the latest version of CF7 your code above used to work until a couple months ago when they went and did some refactoring of the code. [Apr 28 '15]