I have installed the last version of WordPress and this one is coming with a new fancy editor called Gutenberg that is completely changed. After starting using it I have seen that when I was trying to change the category and open the tab the interface crashes. The error was as in the below
As you can see not a lot off informations so I have hit error and I have seen that the actual error was:
TypeError: Cannot read property 'show_ui' of undefined
at https://www.bitdoze.org/wp-includes/js/dist/editor.min.js?ver=9.0.7:55:241505
at i (https://www.bitdoze.org/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91)
at An.filter (https://www.bitdoze.org/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:338)
at https://www.bitdoze.org/wp-includes/js/dist/editor.min.js?ver=9.0.7:55:241470
at ph (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88)
at eg (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
at fg (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
at wc (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
at fa (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
at ng (https://www.bitdoze.org/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:149:69)
First I have tried disable all the plugins, this didn’t do the trick and the error was still present.
I have my own VPS and I thought to try update PHP maybe it could help, I have gone from PHP 7.1 to PHP 7.3 but still same issue.
After I have started searching online to see what I can find and there were a couple of topics like issue 10162 where I have seen that the issue may come from an NGINX config. I did the change restated NGINX service and error dissapeared.
In my configuration I was having the below which caused the issue:
try_files $uri $uri/ /index.php?q=$request_uri;
You can also have:
try_files $uri $uri/ /index.php?q=$uri$args;
To fix the error you just need to replace the above with below and restart nginx service:
try_files $uri $uri/ /index.php?$args;
That’s all, after doing this the error was gone and I can write posts.
You encounter the error? If so what you did to fix it?
Oleg says:
Thanx for solution!
Darshan Jain says:
Hey its working fine if permalink is like this : – https://www.example.com/blog/?p=123 (plain)
but if i used this permalink https://www.example.com/blog/sample-post/ so its not working 🙁 …
Plz help.
admin says:
Do you use nginx as a web server? If so then you need to be sure you have set : try_files $uri $uri/ /index.php?$args;
For complete NGINX config you can check:
https://www.wpdoze.com/wordpress-hosting-install-php7-and-virtualmin-on-centos-7-2/
Darshan Jain says:
My Current Scenario are,
permalink is set to https://example.com/wordpress/sample-post/
and config is
location /wordpress {
alias /var/www/html/wordpress;
try_files $uri $uri/ /wordpress/index.php?$args;
}
and i am getting these errors when try to add new post.
“Update failed” in add post page
and console errors :-
api-fetch.min.js?ver=2.2.7:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
at b (api-fetch.min.js?ver=2.2.7:1)
editor.min.js?ver=9.0.7:12 Uncaught (in promise) {code: "invalid_json", message: "The response is not a valid JSON response."}
admin says:
Hello,
For subfolders you need something else .
In your case you can try with:
location /wordpress {
root /var/www/html/wordpress;
index index.php index.html index.htm;
try_files $uri $uri/ /wordpress/index.php?$args;
}
If not working then also you can try:
– don’t use /wordpress only use:
location / {
try_files $uri $uri/ /wordpress/index.php?$args ;
}
– if above doesn’t work maybe below:
location / {
try_files $uri /wordpress/index.php?q=$uri&$args;
}
location /wordpress {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
Tx
Dragos
Darshan Jain says:
Thank you so much for reply. Yes, i am using NGINX, I have followed this tutorial for installing wordpress
https://websiteforstudents.com/install-wordpress-4-9-on-ubuntu-17-04-7-10-with-nginx-mariadb-and-php/
and i have tried this
try_files $uri $uri/ /index.php?$args; and also multiple combinations but no one worked for me 🙁
i want to run my blog in subfolder.
i have written these lines in config files
location /wordpress {
alias /var/www/html/wordpress;
#try_files $uri $uri/ /wordpress/index.php?q=$request_uri; (not working)
try_files $uri $uri/ /index.php?$args; (not working)
}
These are working fine if permalink set to https://www.example.com/wordpress/?p=123
but not working https://www.example.com/wordpress/sample-post/
that i already mentioned in my first comment.