Support » Plugin: Contact Form 7 » [Plugin: Contact Form 7] URL Redirect if wp_footer not being called

  • Resolved steckinsights


    For most people who arrive on this question from a Google search, the advice that you’re probably looking for is to add the following to the “additional settings” section of the Contact 7 admin within WordPress dashboard:

    on_sent_ok: "location.replace('');"

    (see this post)

    For others, you can modify the scripts.js file using the instructions from @jcstewart in that same post.

    But for me, this hasn’t helped. I, unfortunately, removed the wp_footer tag from my theme because I have pages showing up in a thickbox page; when the thickbox is closed and reloaded, it would load an additional thickbox underneath (very frustrating).

    So, some posts recommended that it was necessary for wp_footer to be loaded in order for the url redirect to work in contact form 7. They said that certain javascript was called, but I’m not sure which necessary javascript is being called by wp_footer.

    How can I get around this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • No responses yet. Another day of trial & error testing.

    I’ve discovered that I could call the thickbox feature in another way. In case you’re interested, I used this method:

    <!– Begin Thickbox Initialization –>
    <?php wp_enqueue_style(‘thickbox’); ?>
    <?php wp_enqueue_script(‘jquery’); ?>
    <?php wp_enqueue_script(‘thickbox’); ?>
    <!– End Thickbox Inititialization –>

    Originally, I had used a function in my functions.php file that called thickbox, but the problem was that the script was being called multiple times when my thickbox opened a page, which caused the thickbox to open multiple times after being closed and reopened.

    Anyway, changing this allowed me to keep wp_footer, which supposedly was what was causing Contact Form 7 and on_sent_ok to not work. But that doesn’t seem to have fixed it (though it fixed my thickbox problem and I’m sure is the better way of accomplishing that task).

    So I’m still wondering why Contact Form 7’s on_sent_ok method (placed in additional settings within the admin panel) is not redirecting to a URL that I’ve defined.

    I’m using WordPress version 3.3.1 and Contact Form 7 version

    I’ve tried deactivating plugins to see if it was a conflict there, but that doesn’t seem to be the case.

    When I fill out the form and click “send” the thickbox disappears and I see the cleared form with text confirming that the form was submitted correctly:

    Your message was sent successfully. Thanks.

    The URL looks like this:

    This happens whether or not the form is run through thickbox, so thickbox is not the problem.

    Yeah, I’m going to be one of those guys… who posts to his own posts. But I figure it’s good policy to respond when a solution is found.

    I visited this post:

    Dani Mage had similar symptoms as I, so I tried adding the following code to the end of the message “Sender’s message was sent successfully” (replacing the URL with whichever page you desire):

    <script>location.href=”;; </script>

    I don’t think this was the best way to fix it, and I’d really like to know what is causing the conflict in the first place – my “additional settings” are not being honored. The “on_sent_ok” method is still not working for me. But this hack bypasses that step. It’s not seamless and not perfect, but I need to move on.

    If anyone else has a better fix for this, please let us know. I’m sure Dani Mage and I would be happy to hear the answer.

    I am having this exact same issue, adding in

    <script>location.href=""; </script>

    worked but I would also like to see if anyone has a answer.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Contact Form 7] URL Redirect if wp_footer not being called’ is closed to new replies.