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 =
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
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
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