Redirect after succesfully
-
I have a question about the redirect function of Contact For 7. I used the on_sent_ok: “location = function, but this function will be out of date at the end of this year.
So I followed the guide at your website to replace this code with on_sent_ok: “ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );”, and added in the bottom of the functions.php file the other code:
add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
function mycustom_wp_footer() {
?>
<script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );
}, false );
</script>
<?php
}In the header.php I put the other script code to redirect to the right page:
<script>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
location = ‘http://www.example.com/’;
}, false );
</script>But when I saved it, I got the 500 error message from the browser. When I delete the codes, everything works fine again. How can I replace this code for the correctly one to redirect the contact forms to the thank you page?
The topic ‘Redirect after succesfully’ is closed to new replies.