Created
October 1, 2019 18:06
-
-
Save Galibri/ab304eebd8402483a1d5f94f6a9d4094 to your computer and use it in GitHub Desktop.
Contact Form 7 Redirect using functions.php file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_footer', 'bsd_cf7_redirect_wp_footer' ); | |
function bsd_cf7_redirect_wp_footer() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
// here 4423 is the id of the form, replace it with your form id | |
if ( '4423' == event.detail.contactFormId ) { | |
location = 'https://secova.com/thank-you-demo'; | |
} | |
// here 4513 is the id of the form, replace it with your form id | |
if ( '4513' == event.detail.contactFormId ) { | |
location = 'https://secova.com/thank-you-contact'; | |
} | |
}, false ); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment