I maintain a website with lifelong learning courses, and we use CF7 in various places. I updated from 4.7 to 4.9 a few days ago, and had the same issue of the forms all breaking.
A bit of investigation turned up two problems:
1) The nginx server our site is hosted on had a redirect rule set up that automatically added trailing slashes to all site URLs via a 301 redirect. This resulted in the new REST endpoint that CF7 uses as of v4.8 being redirected to a version with a trailing slash:
/wp-json/contact-form-7/v1/contact-forms/[postID]/feedback
redirected to
/wp-json/contact-form-7/v1/contact-forms/[postID]/feedback/
The version with the slash, of course, was not a registered REST endpoint, and 404ed, breaking the contact form. We changed our nginx configs so that the trailing slash was not added to any URLs containing wp-json.
2) With that fixed, the contact form was still broken – the emails were sent, but the form never completed as far as users could tell, they just saw the spinny. It turned out an unrelated plugin of ours (in this case, WooCommerce LearnDash Integration) was doing some slightly broken stuff during REST API registration, which resulted in PHP errors being included in the AJAX return from REST, which of course were not valid JSON and broke the clientside plugin. Hacking that other plugin to fix the broken bit finally let our CF7 contact forms work correctly.
The specifics may not help anyone, but my observation is that CF7 v4.8+ is not actually broken, but it *does* assume that your site’s REST API will be functional. There may be several things preventing that from actually working (for any plugin), but if this is the first plugin you have to actually use REST, as it was for us, you might not have realized it. The Network tab in Chrome Developer Tools is super helpful here – check out the calls against that ‘feedback’ endpoint when you try to submit the form, and see if there is a 404 or if the json response has junk in it. Fix those issues, and, at least for us, CF7 v4.9 works nicely.
-
This reply was modified 7 years, 2 months ago by birdev.