Telephone: 0844 967 0565 Email:

Contact Form 7: Redirect to a Thank You (Success) Page in WordPress 3

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:
(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 = '';"

Obviously replace the ‘’ 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.

To find out how PushON research & analysis services can give your company a competitive online edge, simply call 0844 967 0565 or contact us via our form.

  • Pingback: Contact Form 7 – Thank You Page | Web Toastie

  • Frog

    I love you, this worked! Now to fathom out how to add JS to just the thank you page :S

  • kay dinsdale

    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’ ( which I’m using on So far I’m impressed and prefer it to contact form 7. Take a look :)

  • Sam

    It’s not working for me and I have no idea what else to do. I feel like I’ve tried everything. Please help!

  • obi

    it doesnt work >_<

  • Tom

    Thanks so much – this is a great plugin and your fix has been a huge help!

  • brian

    still does not work – any ideas, did all the above and still hangs. stupid plugin.

  • Kieron Hughes

    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.



  • admintiger

    The BETA version of Contact Form 7 fixes the redirect problem with Firefox, but not with Internet Explorer.

  • Erica Douglass

    Works for me in both IE/FF as well as Chrome. Thank you!

  • mazhar

    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) {

  • mazhar

    you can find the script file in


    if you still face the error 404 page problem than simply add the below code in footer.php file of theme


    Note wp_footer(); function should be in php tag like:

  • Stephanie Cockerl

    Thanks for the tip. It worked!

  • Fred

    Cant get that to work mazhar.

  • zeshan

    i have tried alll, but its not working for me plz help:(

  • JHouse

    F yeah, great piece of code there. Thanks. Works like a champ!

  • Hilary Brooks

    This works fantastic! For me, Contact Form 7 beta version was not required. I simply added the code to the settings area and viola! Thanks so much for providing this helpful tip!

  • Aetys

    It’s working for me, thank you !


    Thank you, Kieron. This was very helpful in a recent website upgrade for one of our customers. I have always found the default “green outline message” to lack the usability and sleekness that a website really needs.

  • Neil

    Hi Kieron. This was working for me a few months but not so anymore. Have any updates stopped it from working?

    Currently my url redirects to something like this: (the content stays the same – so there is no ‘success page’)
    when previously it use to redirect to just like you say in your post.

  • Magento Agentur

    nice code, great work!

  • Adam Burt

    Anyone still having trouble with this, you could try the PHP way – Add something like this to your functions.php file:

    function redir_after_form_sent($form) {
    if ($form->title == “Ask a question”) {
    header(‘Location: /thank-you’);
    add_action(‘wpcf7_mail_sent’, ‘redir_after_form_sent’);

  • Templatespress

    hi “Adam Burt” it not working for me

  • Dennis de Roo

    People who having trouble with this, be sure you’ve added wp_footer() just before the closing tag.

    • Dennis de Roo

      * closing body tag

  • Paddy Ryan

    Hi guys, I know this has been covered before, but I’ve tried the adding code to function.php and tried the redirect via the additional settings. Nothing seems to be working :( Like everyone else, I’m trying to redirect the form to a landing page post form submission!! Any help will be GREATLY appreciated!!

  • Nehemiah c

    Blow code is working good in Contact Form7 Version 3.8.1. Thanks for your support.

    (Solution #1: Simply put this code in the “Additional Settings” area of the Contact form 7 Admin:)

    on_sent_ok: “location = ‘’;”