Skip to content

Instantly share code, notes, and snippets.

@cwylie0
Created January 30, 2019 19:53
Show Gist options
  • Save cwylie0/b902ce8febde536c390d559f1ac9d618 to your computer and use it in GitHub Desktop.
Save cwylie0/b902ce8febde536c390d559f1ac9d618 to your computer and use it in GitHub Desktop.
Contact Form 7 Redirect to URL Function
/* The following function is the new method to redirect to a thank you page after contact form 7 submission. Add it to the functions.php file of your theme. */
add_action( 'wp_footer', 'redirect_cf7' );
function redirect_cf7() {
?>
<script type="text/javascript">
// Insert your redirect URL as the location below.
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'http://careers.ifixyouri.com/thank-you/';
}, false );
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment