Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 = '';
}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment