如何获取当前的CF7 ID

时间:2019-08-08 10:03:52

标签: php wordpress contact-form-7

使用wpcf7_mail_sent方法发送邮件后,我一直在尝试获取当前的联系表单ID。我的代码如下

function action_wpcf7_mail_sent( $contact_form ) { 
  // Run code after the email has been sent 
  $wpcf7_cur = WPCF7_ContactForm::get_current();
  $wpcf7 = WPCF7_Submission::get_instance();

  if($wpcf7_cur->id() == '29052'){      
    //echo 'this is test';
  }    
} 

add_action( 'wpcf7_mail_sent', 'action_wpcf7_mail_sent');

我只想从帖子中获取图片网址,并在提交表单后将其替换为另一个网址。

但是当前此代码使表单等待提交的过程无休止。它没有提交,但是我正在接收邮件。

0 个答案:

没有答案
相关问题