Closed barryblueice closed 1 year ago
已经找到原因了,打开Gutenberg 编辑器就会报错,关闭就不会报错。
可以复现
在启用gutenberg时使用新版的采用区块编辑器的/wp-admin/widgets.php
随便插入一个区块(不是legacy widgets里的,其是禁用gutenberg时在widgets.php
添加的那种旧版小工具)并保存就会导致
There was an error. Cannot read properties of undefined (reading 'hasOwnProperty')
/wp-includes/js/dist/edit-widgets.min.js
:
本质上是因为/wp-json/batch/v1
的后端返回了http400 The provided widget type (id_base) cannot be updated.
错误
这个问题已经修复了,由于在经典模式禁用了WP_Widget_Block,所以在古登堡模式会出异常,更新主题版本即可修复。
TypeError: Cannot read properties of undefined (reading 'get') at Ne._createWidget (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/customize-widgets.min.js:7:30146) at https://c0.wp.com/c/6.0.1/wp-includes/js/dist/customize-widgets.min.js:7:31231 at Array.map ()
at Ne._updateWidgets (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/customize-widgets.min.js:7:31137)
at Ne.setWidgets (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/customize-widgets.min.js:7:31426)
at https://c0.wp.com/c/6.0.1/wp-includes/js/dist/customize-widgets.min.js:7:17182
at pt (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/vendor/react-dom.min.js:9:44204)
at ht (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/vendor/react-dom.min.js:9:44658)
at Object.useState (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/vendor/react-dom.min.js:9:107007)
at e.useState (https://c0.wp.com/c/6.0.1/wp-includes/js/dist/vendor/react.min.js:9:10899)
切成其他主题就没有报错……