Hi there,
I’m using Contact Form 7 for my forms. One of the forms currently has a “on_sent_ok” directive to automatically redirect the page to a custom ‘thank you’ page.
I’ve heard that “on_sent_ok” is being deprecated at the end of 2017, and that page redirects should be handled using DOM events in future.
I’ve added the following to my child functions.php, but the page redirection doesn’t work. Any thoughts?
add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( ‘5919’ == event.detail.contactFormId ) {
location = 'https://kexino.com/thank-you';
}, false );
</script>
<?php
}