Support » Plugins » [Plugin: Contact Form 7] Issues with ‘Redirecting to Another URL After Submission’

  • So what is the correct syntax to forward a submitted form to a thank you page? I’ve found half a dozen different ways and none of them seem to work both in IE and FF. Actually only one would work in FF and none in IE that I’ve been able to tell. But now that I’m trying them again none of them work in FF either. I think I’m going crazy.

    The most trustworthy site for reference I would guess would be: and this it states to use:
    on_sent_ok: “location = ‘’;”

    looking through the forums after this solution didn’t work I found:
    on_sent_ok: “location.href(‘’);”
    on_sent_ok: “location.href = ‘’;”
    on_sent_ok: “window.location=’’;”
    on_sent_ok: “location.replace(‘’);”

    The emails still get sent but the redirect does not. But when I put these on_sent_ok lines into the additional settings, the emails are sent but the feedback success message doesn’t show up anymore. Validation error messages do still show up though.

    I’m using the latest version of the plugin (2.2.1) I have taken care to make sure the theme and the page include the wp_footer and have viewed the source on the page containing the form and see the /wp-content/plugins/contact-form-7/scripts.js?ver=2.2.1 file. I love this plugin, but have spent the better part of a full day trying to get this to work. Thought it was fixed once but then I checked the internet exploder and no dice. Any clarification or insights would be greatly appreciated. Thanks!

Viewing 15 replies - 1 through 15 (of 24 total)
  • My problem is similar. I had a form with a redirect that was working just fine. However, I upgraded to WordPress 3.0 and upgraded the Contact 7 plugin to 2.2.1 and now the redirect doesn’t work. I get a spinning arrow that just sits there.

    It seems that this is a major bug; we also used the on_sent_ok-Feature and it worked well before upgrading to WP 3.0. When submitting a form, the spinning arrow loads endless, no success-message appears, but the data was sent. When I removed all on_sent_ok commands the form was submitted and cleared, the success-message appears an everything seems to be okay. but this is no solution to me…

    For WP 3.0 users, try the development version, please. It should have fixed the bug.

    Sorry for this inconvenience.

    Thanks takayukister it works in WordPress 3.0 now!

    I have the same problem too, that the redirection won’t work.
    I use WP2.9.2 with latest version of contact form 7.

    I tried all the 4 different syntaxes of the redirection, but nothing works.
    It does send the mail with the form, but no redirection, just the ajax loader animated gif keeps showing.

    I also ofcourse, using the <?php wp_footer();?> in the theme.

    Should I also upgrade to the development version, as I use WP2.9.2 and not 3.0


    Some more info about the problem:

    The page with the currently temp form is :

    When sending the form, firebuging it I see in the POST :

    _wpcf7 2
    _wpcf7_is_ajax_call 1
    _wpcf7_unit_tag wpcf7-f2-p1642-o1
    _wpcf7_version 2.2.1
    cellphone 050-333333
    firstanme sss
    lastname 111
    phone 03-33333

    The server response is :

    { “mailSent”: 1, “into”: “#wpcf7-f2-p1642-o1”, “captcha”: null, “message”: “Message sent successfully. Thankx”, “onSentOk”: [“location = \’\’;”] }

    I’d like to think I’m just having a blonde day – but after deleting the old version and uploading the redeveloped version, I still can’t get the form to show?

    It IS working on this site for me with 3.0??

    Thanks in advance for your insight.

    Circlecube – looks like you looked into this thouroughly!

    Did you solve it?

    I’m in the same boat (WP 3.0 – need to redirect forms to aa url on send_ok – but two different urls for two different forms).

    I upddated Contact Form 7 plugin to the development version posted by takayukister and it fixed the continually spinning ajax button.

    But I still can’t get a page to redirect 🙁

    However my html is not valid and my custom theme doesnt include wp_footer function it seems so i’ll try those next as per the advice on

    I use still 2.9.2 but I solved my issue.
    After spending lots of hours with this issue, I discovered that the call to Google’s jQuery 1.4.2 was the source of the problem.
    When removing the call to jQuery, the on_sent_ok started to do the redirection as needed.
    So for the meantime, I added an if statement on my header.php, to exclude the jQuery call if this is the form page, which actually don’t really need the jQuery library in it for me.
    Hope my hours of investigation will help someone here with this issue.


    where do you and how do you remove the jquery call?


    worked for me tooo!
    yeah. thank you.


    I put this if statement in my header.php, inside the <head> section
    I removed for the form page both jQuery and two other js scripts that weren’t needed.
    In my example, the form page id was 1612, just replace the number with your page’s number:

    <?php if (!is_page('1612')) :?>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.cycle.all.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script>
    <?php endif;?>

    Hope it helps for the moment, and hope also that it will be fixed in the CF7 next version, if the plugin’s creator visits this page 🙂

    Greetings everyone!, I updated to the development version and it works in wp3 for me, but what I’m trying to do is this:

    I’ve contactform7 working together with a payment gateway plugin, and once the contact form (that is used as a checkout form) sends the e-mail, I want to redirect my information to another page. The problem is that the redirection cleans all my POST variables and I need to keep them on $_POST…ideas? :-p

    Thanks in advance.

    I’m having the same issue. My forms send, and the data sends successfully, but I get the spinning arrow and no redirect. I am running WP 3.0 and uploaded the developer version of the plugin. I’ve checked for the AJAX functions in wp_header and wp_footer, and they are both there. I’ve also tried deactivating all other plugins. I’ve also tried adding the code from @maorb above to my header.php file, but it doesn’t seem to have made a difference.

    I appreciate any ideas anyone might have!


    When trying my code snippet, have you change the number of the
    to your specified page number that holds the form?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Plugin: Contact Form 7] Issues with ‘Redirecting to Another URL After Submission’’ is closed to new replies.