Skip to content

Instantly share code, notes, and snippets.

@Galibri
Created October 1, 2019 18:06
Show Gist options
  • Save Galibri/ab304eebd8402483a1d5f94f6a9d4094 to your computer and use it in GitHub Desktop.
Save Galibri/ab304eebd8402483a1d5f94f6a9d4094 to your computer and use it in GitHub Desktop.
Contact Form 7 Redirect using functions.php file.
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