In this article we’re going to take a look at how to redirect the page after a Contact Form 7 Submission. This could be to a thank you page, or special offer page, or a range of other useful information pages.
The standard format for a Contact Form is to display a message on submission within the same page. You can customise these messages however, it’s often much easier from an analytics perspective to have a specifically dedicated thank you page.
You can then track the hits on that thank you page, and any special offer conversions within the page much more easily. It also means that if you have multiple forms within one page or throughout the site you can see which of the thank you / special offer pages either perform the best or get the most traffic.
All in all it’s an extremely useful tool to be able to set up the redirect on form submission so let’s take a look at how to implement it:
Using a Plugin to Redirect the Page After Submitting the Contact Form:
https://en-gb.wordpress.org/plugins/wpcf7-redirect/
This plugin is great and really quick and simple to get set up with. After installation you get an extra tab within your Contact Form 7 configuration screen titled ‘Actions’. From here you can set redirections and other actions that occur when your form is submitted.
It really is as quick and easy as that!
Redirecting the Page After Submitting the Contact Form Without Using a Plugin:
There’s a great article on this exact topic featured on the main Contact Form 7 website here: https://contactform7.com/redirecting-to-another-url-after-submissions/
In this post the code snippet used is:
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'http://example.com/';
}, false );
</script>
This snippet effectively uses a Javascript Event Listener to redirect the user when the form is sent. We won’t delve into it much more than that as the post itself covers the details however if you’re not sure of how to add Javascript to WordPress take a look at our article here.
In the code above you just need to change the URL to the page that you would like to redirect the user to following a successful form submission for example:
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://techtyped.com';
}, false );
</script>
So in the above example we’ve set the URL to the URL of this current website. Yours might be your website address + /thank-you-page as an example.
Further Reading:
Storing Contact Form 7 Submissions
How to Add Conditional Fields to Contact Form 7
Summary:
So as shown above there are two great approaches to redirecting your users following form submission with Contact Form 7. The one that you use will depend on the type of site that you’re building and how comfortable you are with WordPress. We hope you found this helpful, if you did we would really appreciate a comment and a share thanks!








