Contact form 7 : Redirect after form submit
Contact form 7 is a very good plugin, generally we are using it in form submission in wordpress. Normally it uses ajax for showing validation errors while filling the form. If all the values filled in the form are as per the requirement then a successful message appears after the submission through ajax.
Sometimes we need to redirect the page after form submission like when we are using google analytic tracking or for any other reason. So, in this case we need to use a java script action hook that is “on_sent_ok”. This hook will run any java script code just after the successful submission of the form. To use it for redirecting to thanks page, no requirement of modifying any theme file. Just put this in admin as mentioned below :
on_sent_ok: "location = 'http://mywebsite.com/thank-you';"
Where to place this : To find the placement of the above mentioned code we need to follow the path mentioned below :
Go to admin => Contact => My Form(Select the form) => Additional Settings (Setting at the bottom of the page)
In this way, just after the form submission user will redirect to “Thank You” page of our website. We can redirect anywhere we want as per our requirement, just need to change the url.