Describe the bug
Clicking "Add New" to create a new Post causes Gutenberg to appear briefly, then it's immediately replaced with the "The editor has encountered an unexpected error." screen showing three buttons.
Error is:
TypeError: Cannot read property 'show_ui' of undefined
at https://csixty4.com/wp-content/plugins/gutenberg/build/editor/index.js?ver=1533864911:12:289913
at i (https://unpkg.com/[email protected]/lodash.min.js:6:91)
at An.filter (https://unpkg.com/[email protected]/lodash.min.js:99:338)
at https://csixty4.com/wp-content/plugins/gutenberg/build/editor/index.js?ver=1533864911:12:289878
at yh (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:96:396)
at lg (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:120:88)
at mg (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:120:386)
at gc (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:127:202)
at vb (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:126:230)
at ub (https://unpkg.com/[email protected]/umd/react-dom.production.min.js:126:65)
The site is running a third-party theme but switching to Twenty Seventeen doesn't fix. There's also an mu-plugin defining a custom taxonomy but removing it doesn't fix – and the error appears to be happening for the Categories taxonomy.
Debugging the code in question points to this code:
return Object(s.filter)(i, function(e) {
return e.visibility.show_ui
}).map(function(e) {
at that point, e looks like:
e:
description: ""
hierarchical: true
name: "Categories"
rest_base: "categories"
slug: "category"
types: ["post"]
_links: {collection: Array(1), wp:items: Array(1), curies: Array(1)}
__proto__: Object`
(no show_ui member)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Gutenberg editor loads
Desktop (please complete the following information):
This is similar to #8456 #8441
I'm not using Cloudflare. WordPress is running in php-fpm behind Caddy web server.
Tested with the current .org version of Gutenberg and master from the repo.
Thanks for the bug report, @daveross!
What version of WordPress are you running?
Do you have any other plugins installed?
WordPress 4.9.8. No other plugins besides Gutenberg and the mu-plugin that registers the taxonomy.
Possibly related to WordPress commit 2f792d442bf771a3aade170cc9cae459f024c57b which removes visibility from the REST API response by default?
Closing this for now. Appears to be tied to the Caddy configuration usually recommended:
rewrite {
if {path} not_match ^\/wp-admin#
to {path} {path}/ /index.php?_url={uri}
}
In WP Core, WP_REST_Server accesses $_GET directly, and in this case $_GET only contains _url.
Fixed by changing the Caddy setup for this site so it passes the query string unchanged:
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?{query}
}
Huh, interesting. Thanks for tracking that down. 🙂
Hi, I'm running on nginx and getting this error straight after upgrading to Wordpress 5.0.
Any ideas? thanks!
Just to confirm, the solution in #9912 worked for me...
https://github.com/WordPress/gutenberg/issues/9912#issuecomment-445609896
Just wanted to report that I've had the same issue with my Caddyfile, and the solution above worked.
#rewrite {
# if {path} not_match ^\/wp-admin
# to {path} {path}/ /index.php?_url={uri}
#}
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?{query} }
}
Most helpful comment
Closing this for now. Appears to be tied to the Caddy configuration usually recommended:
rewrite { if {path} not_match ^\/wp-admin# to {path} {path}/ /index.php?_url={uri} }In WP Core,
WP_REST_Serveraccesses$_GETdirectly, and in this case$_GETonly contains_url.Fixed by changing the Caddy setup for this site so it passes the query string unchanged:
rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?{query} }