gpt4 book ai didi

php - ContactForm7 在提交 WordPress Woocommerce 网站时显示 POST 和 GET 错误

转载 作者:行者123 更新时间:2023-12-05 08:22:00 25 4
gpt4 key购买 nike

我最近在我的 WordPress woocommerce 网站上开发并部署了一个网站,在我将该网站置于其域上后弹出一个奇怪的错误。之前它致力于开发子域。

我在提交 ContactForm7 时遇到问题,当有人要提交 contactform7 时我收到错误

控制台输出中记录的错误是:

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, …}

Check the Image for error log on console

我已经尝试过一些解决方案,例如:

  1. 清除缓存文件
  2. 删除现有的 .htaccess 文件并添加默认的 WordPress 的 .htaccess
  3. 更新 Php 内存限制为 1024M 和 512M
  4. 通过设置/永久链接重新生成永久链接(只需点击现有设置的保存按钮)

我提到了很多这个错误,但找不到任何解决方案。我的 contact form 7 测试工作正常。我从中收到测试电子邮件。但它在网站上不起作用。

最佳答案

我只在我管理的一个网站上看到过这种情况。这显然是由于与另一个插件发生冲突,该插件通过仅允许登录用户使用 REST API 来限制对 WP API 的访问。

要禁用通过 REST API 提交,这似乎是导致问题的原因,您可以使用以下行更新 wp-config.php:

define( 'WPCF7_LOAD_JS', false );

或者添加到你的 functions.php

add_filter( 'wpcf7_load_js', '__return_false' );

这将禁用 ajax 提交。该表单将通过“POST”方法提交,然后应该可以工作。

关于php - ContactForm7 在提交 WordPress Woocommerce 网站时显示 POST 和 GET 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67200938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com