最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to pass POST data from Contact Form 7 to another subpage after submitting the form

programmeradmin0浏览0评论

I would like to pass data from Contact Form 7 to another subpage after submitting the form. I would like to use the POST method for this

  • I can get to this data with the wpcf7_before_send_mail filter as follows:
function cf7_data()
{
    $submission = WPCF7_Submission::get_instance();
    $data = $submission->get_posted_data();

    // Here I have a variable containing a field from the contact form
    $subject = $data['your-name'];

    // I don't know what to do next
}
add_action('wpcf7_before_send_mail', 'cf7_data');
  • I can make redirect after submit form as follows:
document.addEventListener( 'wpcf7mailsent', function( event ) {
    location = 'https://samewebsite/subpage';
}, false );

but I can't figure out how I can pass and read the $subject variable on the subpage after the redirection

发布评论

评论列表(0)

  1. 暂无评论