Wordpress Send Form Data on Redirection in Contact Form 7

后端 未结 3 998
庸人自扰
庸人自扰 2021-01-16 12:41

I\'m using the popular wordpress plugin called Contact Form 7. Its easy to redirect the form after submitting to any page by adding this code on_sent_ok: \"location =

相关标签:
3条回答
  • 2021-01-16 13:02

    Just use this hook:

    on_sent_ok: "location = 'https://gettinmobile.com/my-account/checkout/?level=1&' + $('form.wpcf7-form').serialize();"
    

    This will append all the form data as parameters in the query string.

    Cheers, from La Paz, Bolivia

    0 讨论(0)
  • 2021-01-16 13:17

    This is the new way to redirect contact form 7 on submission. Place in functions.php

    add_action( 'wp_footer', 'redirect_cf7' );
       function redirect_cf7() {
       ?>
          <script type="text/javascript">
             document.addEventListener( 'wpcf7mailsent', function( event ) {
             location = 'https://www.example.com/thank-you/';}, false );
          </script>
       <?php
    }
    

    NOTE: This will redirect all contact form 7 submission to that thank you page

    0 讨论(0)
  • 2021-01-16 13:21

    The on_sent_ok is being phased out.

    Note: The method using on_sent_ok hook is no longer recommended. This function is scheduled to be abolished by the end of 2017.

    https://contactform7.com/redirecting-to-another-url-after-submissions

    0 讨论(0)
提交回复
热议问题