[英]Contact Form 7 Hook for skip_mail
我正在使用 Contact Form 7 和 PayPal & Stripe Add-on(用于 Contact Form 7)插件。 在联系表 7 上,我打开了附加设置skip_mail = on
。 当人们已经在 PayPal & Stripe Add-on 插件中付款时,是否可以创建一个钩子来关闭skip_mail = off
并从表单发送数据?
试试下面的代码行。
/*
Prevent the email sending step for specific form and condition
*/
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 (/*Check whether user already paid the payment in the PayPal & Stripe Add-on plugin*/) {
// If you want to skip mailing the data, you can do it...
$wpcf->skip_mail = true;
}
return $wpcf;
}
add_filter( 'wpcf7_skip_mail', function( $skip_mail, $contact_form ){
$skip = ( $contact_form->id() == 111 ) // skip send mail if cf7_id = 111
return $skip; // return true or false
}, 10, 2 );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.