最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom post types - The editor has encountered an unexpected error.TypeError: Cannot read property 'prefix' of n

programmeradmin3浏览0评论

when I tried to edit a post of a custom post type, I experienced this error.

When I press "Copy Error" I am getting this:

TypeError: Cannot read property 'prefix' of null
    at .min.js?ver=3.1.6:12:56693
    at ph (.min.js?ver=16.6.3:97:88)
    at eg (.min.js?ver=16.6.3:125:307)
    at fg (.min.js?ver=16.6.3:126:168)
    at wc (.min.js?ver=16.6.3:138:237)
    at fa (.min.js?ver=16.6.3:137:115)
    at gg (.min.js?ver=16.6.3:135:196)
    at Ca (.min.js?ver=16.6.3:133:365)
    at Object.enqueueSetState (.min.js?ver=16.6.3:191:324)
    at r.q.setState (.min.js?ver=16.6.3:20:304)

when I tried to edit a post of a custom post type, I experienced this error.

When I press "Copy Error" I am getting this:

TypeError: Cannot read property 'prefix' of null
    at https://example.com/wp-includes/js/dist/edit-post.min.js?ver=3.1.6:12:56693
    at ph (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88)
    at eg (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
    at fg (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
    at wc (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
    at fa (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
    at gg (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:196)
    at Ca (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:365)
    at Object.enqueueSetState (https://example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:324)
    at r.q.setState (https://example.com/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:304)
Share Improve this question asked Jan 9, 2019 at 11:43 marvinpoomarvinpoo 3033 silver badges18 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 1

So, I was researching this topic a bit deeper. All answers found on this SE suggested disabling Gutenberg with a plugin. This couldn't be a valid "fix" in my oppinion.

After researching and browsing through the git issues of WordPress/gutenberg I've found a pretty easy solution for this problem.

The user joshuafredrickson on the git suggested changing the args of the custom post type array from 'public' => false, to true.

I have checked that fix on multiple of my clients projects and it has worked every single time.

Credits:

  • https://github.com/WordPress/gutenberg/issues/12482#issuecomment-445022253

Now in 2022, this was solved by changing 'show_in_rest' => true to 'show_in_rest' => false. My public option was already set to true. I thought I needed show_in_rest to be set to true for some reason, but turning it off doesn't seem to be affecting my site at all. We'll see...

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论