Skip to content

Instantly share code, notes, and snippets.

@dustinleer
Created June 14, 2022 16:22
Show Gist options
  • Save dustinleer/2933a6b546c162cd7e0b3023aba0970d to your computer and use it in GitHub Desktop.
Save dustinleer/2933a6b546c162cd7e0b3023aba0970d to your computer and use it in GitHub Desktop.
Contact Form 7 Submission Redirect
<?php
add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
$site_url = get_site_url();
?>
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = '<?php echo $site_url; ?>/landing-thank-you/';
}, false );
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment