简体   繁体   English

ContactForm7 在提交时显示 POST & GET 错误 WordPress Woocommerce 站点

[英]ContactForm7 shows POST & GET error on submission WordPress Woocommerce site

I have developed & deployed an website my WordPress woocommerce website recently and a strange error pop-up after I made the website live on its domain.我最近开发并部署了一个网站,我的 WordPress woocommerce 网站,在我让网站在其域上运行后弹出一个奇怪的错误。 Previously it was working on development sub-domain.以前它在开发子域上工作。

I am facing issue with ContactForm7 submission, I get errors when someone want to submit the contactform7我在提交 ContactForm7 时遇到问题,当有人要提交 contactform7 时出现错误

The Error logged on the console output is:控制台 output 上记录的错误是:

The resource https://domainhidden/wp-content/themes/Divi/core/admin/fonts/modules.ttf was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.
2DevTools failed to parse SourceMap: https://domainhidden/wp-content/themes/Divi/js/custom.unified.js.map
api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2 

POST https://domainhidden/wp-json/contact-form-7/v1/contact-forms/45143/feedback?_locale=user 403 (Forbidden)
F @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
tryCatch @ wp-polyfill.min.js?ver=7.4.4:1
invoke @ wp-polyfill.min.js?ver=7.4.4:1
t.<computed> @ wp-polyfill.min.js?ver=7.4.4:1
n @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
a @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
I @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
f @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
I @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
f @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
t @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
R @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ index.js?ver=5.4:1
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
(anonymous) @ index.js?ver=5.4:1
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
X @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
f @ index.js?ver=5.4:1
(anonymous) @ index.js?ver=5.4:1
Show 2 more frames
api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2 

GET https://domainhidden/wp-admin/admin-ajax.php?action=rest-nonce 400 (Bad Request)
(anonymous) @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
Promise.catch (async)
X @ api-fetch.min.js?ver=a783d1f442d2abefc7d6dbd156a44561:2
f @ index.js?ver=5.4:1
(anonymous) @ index.js?ver=5.4:1
index.js?ver=5.4:1 
Response {type: "basic", url: "https://domainhidden/wp-admin/admin-ajax.php?action=rest-nonce", redirected: false, status: 400, ok: false, …}

在控制台上检查图像以获取错误日志

I have already tried some of solutions found like:我已经尝试了一些解决方案,例如:

  1. Clearing Cache files清除缓存文件
  2. removing the existing .htaccess file and adding the default WordPress's .htaccess删除现有的 .htaccess 文件并添加默认 WordPress 的 .htaccess
  3. Updating Php memory limit did 1024M and 512M更新 Php memory 限制做了 1024M 和 512M
  4. Regenerating permalink via settings/permalink (just clicked on save button with existing settings)通过设置/永久链接重新生成永久链接(只需使用现有设置单击保存按钮)

I referred a lot of this error but cannot find any solution.我提到了很多这个错误,但找不到任何解决方案。 My contact form 7 test is working properly.我的联系表格 7 测试工作正常。 I get Test email from it.我从中得到测试 email。 But it doesn't work on the website.但它在网站上不起作用。

I've only seen this happening on one site that I manage.我只在我管理的一个站点上看到过这种情况。 It is apparently due to a conflict with another plugin that has limited access to the WP API by only allowing logged in users to use the REST API.这显然是由于与另一个插件发生冲突,该插件通过仅允许登录用户使用 REST API 来限制对 WP API 的访问。

To disable submission via the REST API, which is what appears to be causing your problem, you can update your wp-config.php with this line:要禁用通过 REST API 提交,这似乎是导致您的问题的原因,您可以使用以下行更新您的 wp-config.php:

define( 'WPCF7_LOAD_JS', false );

or add to your functions.php或添加到您的功能中。php

add_filter( 'wpcf7_load_js', '__return_false' );

This disables the ajax submission.这将禁用 ajax 提交。 The form will submit via "POST" method and should then work.该表单将通过“POST”方法提交,然后应该可以工作。

Contact Form 7 has some issues since the last update two month ago as you can see here: https://wordpress.org/support/plugin/contact-form-7/reviews/?filter=1联系表格 7 自两个月前的上次更新以来存在一些问题,您可以在此处看到: https://wordpress.org/support/plugin/contact-form-7/reviews/?filter=1

I'm afraid to recommand to not use Contact Form 7 anymore.恐怕我建议不要再使用联系表 7。

As per @flexy's comment, I read that recent update on cf7 is unstable and has caused a lot of issues.根据@flexy 的评论,我读到 cf7 的最新更新不稳定,并引起了很多问题。 That is when I realised that before going live I, too had updated all the plugins.那时我意识到,在上线之前,我也更新了所有插件。

So the solution was:所以解决方案是:

Downgrade the contact form 7 to older stable version Use WP Rollback plugin to downgrade the version将联系表 7 降级为较旧的稳定版本 使用 WP Rollback 插件降级版本

The version which is unstable of cf7 is 5.4.0 cf7不稳定的版本是5.4.0

What worked is downgrading to one version back 5.3.2有效的是降级到一个版本回到 5.3.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM