404 Error Contact Form 7 ajax form submitting
Asked Answered
T

4

5

The contact form does not work, and affects loading after one try. The chrome console shows the error message:

POST http://example.com/wp-json/contact-form-7/v1/contact-forms/50/feedback 404 (Not Found)
send @ jquery.js?ver=1.12.4:4
ajax @ jquery.js?ver=1.12.4:4
wpcf7.submit @ scripts.js?ver=5.0.3:346
(anonymous) @ scripts.js?ver=5.0.3:53
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3

How to solve this issue? thanks in advance

Travax answered 17/7, 2018 at 4:59 Comment(3)
can you please share your form data and contact form 7 versionWendelin
this is my form data <p class="inp_user">[text* your-name placeholder "Your Name"]</p><p class="inp_tit">[text your-subject placeholder "Title"]</p><p class="inp_mail">[email* your-email placeholder "Email"]</p><p class="inp_ph">[text* your-phone placeholder "Phone"]</p><p class="inp_com">[textarea your-message placeholder "Comments & Questions"]</p><p>[recaptcha]</p><div class="sub_block"><span class="sub_but">[submit class:sub "SEND REQUEST"]</span></div> and contact form version is 5.0.3 and word press version is 4.9.7 @Mukesh PanchalTravax
can you please share your online demo url as i don't get any error when i use above CF7 code.Wendelin
J
26

I had the same issue after migrating the site, re-save the Settings -> Permalinks in wordpress fixed it.

Journeyman answered 22/11, 2018 at 3:49 Comment(3)
In most cases, this will be the solution as the url will be handled by the url mapping. For future visitors, try this first.Skiagraph
PERFECT! It happened just after I moved this website to production. Thanks!Misreckon
Youre the god most noble sire, the god. saved me a lot of troublesCryolite
S
9

FINALLY FIXED!!

Since I'm using nginx all the solutions doesn't worked for me.

I finally fixed that error adding the following lines to the nginx.conf (or file wich contains your server config)

location ~ ^/wp-json/ { rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last; }

I hope it helps to someone

Slabber answered 14/4, 2019 at 17:23 Comment(1)
Worked for me in 2021Righteousness
A
0

downgraded to version 7.4.7 https://downloads.wordpress.org/plugin/contact-form-7.4.7.zip

kredit to https://wordpress.org/support/topic/wp-json-contact-form-7-v1-contact-forms-3453-feedback-404-not-found/

thank you so much ! to vesylivskyy (@vesylivskyy).

Arbalest answered 14/2, 2022 at 2:39 Comment(1)
In mycase the conflict was due to wordpress.org/plugins/contact-form-7-to-database-extensionKarakorum
I
-1

You Error message clearly shows that particular endpoint doesn't exists.

http://example.com/wp-json/contact-form-7/v1/contact-forms/50/feedback

What i remember, the Wordpress json API mappings has base address of

http://example.com/wp-json/wp/v2/

So, try once if your url is working with this base address or not. Change url to

http://example.com/wp-json/wp/v2/contact-form-7/v1/contact-forms/50/feedback

Or just check proper mappings from http://example.com/wp-json.

This is not a Wordpress pre-defined endpoint and is enabled by Third party plugin mainly contact-form-7. Make sure you have installed this plugin to your wordpress.

PS : Make sure you are using valid authentication method as certain end-points won't work without that.

Ignazio answered 17/7, 2018 at 5:4 Comment(4)
Check scripts.js file and search for wpcf7.submit . There you will find the URL.Ignazio
Also, check if contact-form-7 or some similar named plugin is installed or not. As this endpoint is from plugin itself.Ignazio
i will try with example.com/wp-json/contact-form-7/v2/contact-forms/50/feedback and example.com/wp-json/wp/v2/contact-form-7/v1/contact-forms/50/… but it will throws the same error if there any alterantive solution @Atul SharmaTravax
You shouldn't be touching the plugin code. This answer is not correct.Skiagraph

© 2022 - 2024 — McMap. All rights reserved.