WordPress.org

Support

Support » Plugins and Hacks » wpcache_broken_message on xhr (Ajax) causing issue with Contact Form 7

wpcache_broken_message on xhr (Ajax) causing issue with Contact Form 7

  • I’ve been debugging a problem a client had after migrating a WordPress site from one host to another.

    The report from the client was that the spinner on Contact Form 7 would just continue and never stop. What I found that is the broken_message function in advance-cache.php was appending

    <!– WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! –>

    not only to the end of every page/post, but also to the end of a JSON response on a request that had the HTTP_X_REQUESTED_WITH header set to “XMLHttpRequest,” meaning the Javascript parsing returned an error since the JSON was invalid.

    Using Firebug, I found that this was the (invalid) JSON being returned:

    {"mailSent":true,"into":"#wpcf7-f1994-p1944-o1","captcha":null,"message":"Your message was sent successfully. Thanks."}<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->

    Is there anyway to not add the html if the request has the HTTP_X_REQUESTED_WITH header set to indicate the request is xhr?

    If it helps, here’s the discussion on the Contact Form 7 support forum:


    wordpress.org/support/topic/cf7-not-working-after-upgrade

    I initially didn’t suspect any other plugins because I had them all disabled (including WP Super Cache) except for Contact Form 7. Once I discovered what was happening by using Firebug, I deleted WP Super Cache and problem was solved. Obviously, my WP Super Cache was misconfigured (due to a host change), which called the wpcache_broken_message function. CF7 worked fine when WP Super Cache was configured properly.

    http://wordpress.org/plugins/wp-super-cache/

  • The topic ‘wpcache_broken_message on xhr (Ajax) causing issue with Contact Form 7’ is closed to new replies.