on_sent_ok not working in Contact Form 7 version 5.0.2
In Contact Form 7, there are several Additional Settings available to add extra functionality to your forms. One of these additional settings was on_sent_ok. But it is not work on version 5.0.2
Instead of this, Using Contact Form 7 Controls plugin the task becomes fairly simple. Once you install and activate the plugin, a Customize tab will appear in each one of your Contact Form 7 forms. Then all you have to do is simply check the option for Google Analytics at the very bottom.
Instead of this, Using Contact Form 7 Controls plugin the task becomes fairly simple. Once you install and activate the plugin, a Customize tab will appear in each one of your Contact Form 7 forms. Then all you have to do is simply check the option for Google Analytics at the very bottom.
Alternative way to use Global redirect via WordPress functions:
This option will utilize a WordPress function which automatically adds the JavaScript into your WordPress footer.
Simply open your function.php file then copy and paste the code below.
add_action( 'wp_footer', 'redirect_cf7' );
function redirect_cf7() { ?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://www.example.com/thank-you/';
}, false );
</script>
<?php }


You can do it in function.php also. May be this methods are deprecated now.
ReplyDelete