Woocommerce 设置失败 [英] Woocommerce Setup Failed
问题描述
我尝试在全新的 WordPress 5.4.1 安装上安装 woocommerce.
I tried to install woocommerce on a fresh WordPress 5.4.1 installation.
Woocommerce 插件已成功安装,但在设置商店时出现错误,显示更新您的首选项时出现问题
,我检查了浏览器控制台,并从它收到的 ajax 调用:
Woocommerce plugin was successfully installed, but when setting up the store, there's an error, it says There was a problem updating your preferences
, I checked the browser console, and from the ajax call it received :
{"code":"woocommerce_rest_cannot_view","message":"You must supply an array of options.","data":500}
我尝试删除应用程序文件夹和数据库,然后重新创建一个新的空数据库,然后重新安装 WordPress,然后设置商店,但仍然收到相同的错误.
I tried to remove the application folder and database, then recreated a new empty database then reinstall the WordPress, then setting up the store, but still receiving the same error.
推荐答案
我终于找到了一个解决方法,我把它分享出来,以防有人和我遇到同样的问题.
I finally found a workaround, I'm sharing it just in case anyone having the same problem as I do.
有人建议我检查站点健康,所以我去那里发现了 3 个警告,最后一个是我唯一需要注意的,它说 REST API 没有处理上下文"查询参数正确
,所以我用谷歌搜索,然后找到了 a解决方法,然后应用它,最后错误消失了.
Someone suggested me to check the Site Health, so I went over there and found 3 warnings, the last one was the only one I had to pay attention, it said The REST API did not process the 'context' query parameter correctly
, so I googled it and then found a workaround, then applied it, and finally the error gone.
这是解决方法,需要在 Nginx 配置中添加:
Here's the workaround, need to add this in the Nginx configuration :
location ~ ^/wp-json/ {
rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}
然后,重启nginx
服务
这篇关于Woocommerce 设置失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!