After update from WP 5.0.2 to 5.0.3 I had issues in wp-admin. I couldn't edit post data. There was JS error "Uncaught SyntaxError: missing ) after argument list", undefined "_" (lodash) etc.


The issue for me was the clean_script_tag() function from Soil.

Removing add_filter('script_loader_tag', 'clean_script_tag'); solved the bug for me.

  • 1
    Or wrap it in if (!is_admin()) to still benefit from it on the front-end. – powerbuoy Oct 1 at 2:51

I found that:

<script type='text/javascript'>( 'fetch' in window ) || document.write( '<script src="http://website.com/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0' defer "></scr' + 'ipt>' ); ...</script>

Note: wp-polyfill-fetch.min.js?ver=3.0.0 ' defer " >

The problem was in the PHP hook added defer to script, like here: How to add defer="defer" tag in plugin javascripts?

Reason: Confusion/conflict with quotes (' & ") witch break down JS.

The solve: Delete/disable the adding 'defer' PHP-hook or add some conditions for don't touch Gutenberg scripts.

More detals here: https://github.com/WordPress/gutenberg/issues/13029

  • I don't see an answer anywhere in this post. Yes, the problem is traceable to incorrect quotes, but how do you fix it? – Ivan Durst Feb 4 at 23:44
  • @IvanDurst Just disable this adding 'defer' PHP code (the easy way) or add conditions by Guttenberg file names or to add 'defer' for not all <script>. More info you can get by links in the answer. Note: you can easily delete 'defer'-code because it's just optimization stuff. – Konstantin Petlya Feb 5 at 10:12
  • thanks for updating, that makes sense, I'll give it a try! – Ivan Durst Feb 5 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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