Solved: TypeError: Cannot read property ‘show_ui’ of undefined

Yesterday, I tried upgrading WordPress to the latest version. After upgrading, I noticed that I can no longer add new posts in my blog using the new editor, Gutenburg. I was getting this error instead:

TypeError: Cannot read property 'show_ui' of undefined
    at http://www.mikkogozalo.com/wp-includes/js/dist/editor.min.js?ver=9.0.6:55:240816
    at i (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91)
    at An.filter (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:338)
    at http://www.mikkogozalo.com/wp-includes/js/dist/editor.min.js?ver=9.0.6:55:240781
    at ph (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88)
    at eg (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
    at fg (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
    at wc (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
    at fa (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
    at ng (http://www.mikkogozalo.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:149:69)

After a bit of Googling, I found discussions online discussing the problem. If you are using nginx and php-fpm to serve your blog, here’s a quick way to fix it!

WARNING: This works for typical configurations only.

Log in to your server and go to /etc/nginx/sites-enabled. Do a directory listing (ls) and look for the file that manages your blog. For mine, it looked like this.

root@core-web:/etc/nginx/sites-enabled# ls
mikkogozalo.com

Now, edit the appropriate file using your text editor of choice. Find the line that says:

try_files $uri $uri/ /index.php?$args;

And replace it with:

try_files $uri $uri/ /index.php?$is_args$args;

Note the difference between the two lines. Make sure $is_args is added after the ? and before $args.

Now, it’s time to restart nginx. If you’re using Ubuntu, you can do /etc/init.d/nginx restart OR service nginx restart. Do note to add sudo if you’re not logged in as root.

Leave a Reply

Your email address will not be published. Required fields are marked *