Contact Form 7 redirect after submission

0
91

Add below code in functions.php (located in themes -> themeName Folder)
//This function prints the JavaScript to the footer
function cf7_footer_script(){

//if page name is contact.
if ( is_page(‘contact-us’)) {?>

<script>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
location = ‘<?php echo site_url();?>/thank-you/’;
}, false );
</script>

&lt;?php }

}
add_action(‘wp_footer’, ‘cf7_footer_script’);

LEAVE A REPLY

Please enter your comment!
Please enter your name here