« PackNet Launch New Website with Help From PushON | Home | SEO and PPC Diagrams »
Contact Form 7: Redirect to a Thank You (Success) Page in WordPress 3
By Kieron Hughes | July 7, 2010
Just a quick blog post today – but it’s probably very useful for people having issues with contact form 7 no longer redirecting properly to a ‘thank you’ page. The previous method of redirecting to a thank you page in the contact form 7 WordPress plugin was to add a line of code to the ‘Additional Settings’ section in the plugin settings – but this method no longer appears to work while using WordPress 3. The solution, however, is relatively simple:
Firstly, make sure you have gone through the process of upgrading your website/blog to WordPress 3 (including all plugins).
Now, download the BETA version of contact form 7 that is currently in development, found here:
http://downloads.wordpress.org/plugin/contact-form-7.zip
(note: use beta versions of software at your own risk)
Backup the current contact form 7 plugin files in the plugins folder (located at /wp-content/plugins), and install the BETA version of the plugin.
Finally, in the contact form 7 settings, replace any previous code you had in the ‘Additional Settings’ field with the following:
on_sent_ok: "location = 'http://www.example.com/thank-you/';"
Obviously replace the ‘example.com’ website URL with a link to your desired thank you (success) page.
That should do it – feel free to leave a comment below if you are having trouble getting it to work.
Topics: Web Development | 12 Comments »


July 7th, 2010 at 11:17 pm
[...] Contact Form 7 – Redirect to a thank you page in WordPress 3 [...]
July 8th, 2010 at 11:02 am
I love you, this worked! Now to fathom out how to add JS to just the thank you page :S
July 8th, 2010 at 3:52 pm
Thanks for this tip Keiron, I use contact form 7 on a couple of blogs but find it’s a bit clunky and slow in sending the message. I recently found the ‘fast and secure contact form’ (http://wordpress.org/extend/plugins/si-contact-form/) which I’m using on http://www.manchesterseo.org.uk. So far I’m impressed and prefer it to contact form 7. Take a look
July 16th, 2010 at 10:46 pm
It’s not working for me and I have no idea what else to do. I feel like I’ve tried everything. Please help!
July 21st, 2010 at 3:15 am
it doesnt work >_<
July 21st, 2010 at 11:30 pm
Thanks so much – this is a great plugin and your fix has been a huge help!
August 3rd, 2010 at 7:06 am
still does not work – any ideas, did all the above and still hangs. stupid plugin.
August 3rd, 2010 at 5:17 pm
Hi Brian,
If you are working on your website in a test environment (or are able to test changes) I would suggest disabling any other plugins you may have running, then see if Contact Form 7 will redirect. Sometimes conflicts can be caused with other plugins installed in WordPress.
If there are no plugin conflicts then it could be a number of possible issues. What version of WordPress are you currently using? I haven’t tested the above fix on WordPress 3.0.1, but I’d imagine it should work (tested on a number of sites with 3.0 and had no problems as of yet).
Also, did you download the plugin directly from the link I provided above? The one available as the main instance of Contact Form 7 is slightly different, so you have to use the file I linked to.
Feel free to ask any more questions if you still can’t get it working.
Cheers,
Kieron
August 4th, 2010 at 11:20 pm
The BETA version of Contact Form 7 fixes the redirect problem with Firefox, but not with Internet Explorer.
August 10th, 2010 at 11:32 pm
Works for me in both IE/FF as well as Chrome. Thank you!
August 30th, 2010 at 7:30 pm
if you want to redirect to success page you urs than you have to edit scripts.js file add the line below 1 == data.mailSent
like :
if (1 == data.mailSent) {
jQuery(data.into).find(‘form’).resetForm().clearForm();
wpcf7ResponseOutput.addClass(‘wpcf7-mail-sent-ok’);
location.href=”http://www.yourdomain.com/yourthankyoupage”;
August 30th, 2010 at 7:32 pm
you can find the script file in
wp-content\plugins\contact-form-7
if you still face the error 404 page problem than simply add the below code in footer.php file of theme
wp_footer();
Note wp_footer(); function should be in php tag like: