</pre> //Redirect Contact Form 7 to custom thank you page add_action( 'wp_footer', 'redirect_cf7' ); function redirect_cf7() { echo '<script type="text/javascript"> document.addEventListener( "wpcf7mailsent", function( event ) { if ( "form_id" == event.detail.contactFormId ) { location = "link"; } }, false ); </script>'; } <pre>