-1

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

enter image description here

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)
0

2 Answers 2

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:

2
  • How do you do this from the wordpress admin?
    – tread
    Commented Jan 9, 2019 at 17:56
  • @StevieG Edit the file that includes the custom post-type
    – marvinpoo
    Commented Jan 10, 2019 at 8:22
0

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...

2
  • Can you please point to the filename and line number where I've got to change this?
    – Talha Imam
    Commented Apr 20, 2022 at 21:58
  • I changed it in my custom post type code in the register_post_type() args. You would not have the same filename and line number since I added the post type in a custom plugin.
    – Michael
    Commented Apr 21, 2022 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.