Web Articles, wordpress tips
Redirecting to Contact form 7 after successful sent
The simplest way is utilizing Contact Form 7’s custom DOM event to run JavaScript. The following is an example of script that redirects you to another URL when the wpcf7mailsent
event occurs:
1
2
3
4
5
|
< script > document.addEventListener( 'wpcf7mailsent', function( event ) { location = 'http://website.com/'; }, false ); </ script > |
Embed this snippet into your theme’s Header file. You will need to replace the http://website.com/ in the code to the URL you want to redirect to.
Example Them header file:
Note: The method using on_sent_ok
hook is no longer recommended. This function is scheduled to be abolished by the end of 2017.
Another Method is by using this plugin from:
Leave a reply
You must be logged in to post a comment.