When trying to edit a wordpress post (page) the editor loads indefinitely, console shows JS error with post.php / polyfill, see code below. To me it seems to be a typo and I have no idea where the line is injected so I could change it manually.

Disabling all plugins did not change anything, neither did disabling Gutenberg. I am not much of a coder, nevertheless it seems to me there should not be a double quotation mark after the last ‘defer”… in the line of code.

I am running WP 5.0.2 on Apache (Domainfactory) in a managed server environment, Theme is Enfold by Kriesi. Re-installing WordPress and the theme (copied from working installations) changed nothing so far.

The reported error in the console is
“Uncaught SyntaxError: missing ) after argument list”
in
https://…/wp-admin/post.php?post=23&action=edit&lang=de&classic-editor=1:238

There it says

( 'fetch' in window ) || document.write( '<script src="https://12345678-123.ch/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0' defer="defer"></scr" + 'ipt>' );( document.contains ) || document.write( '<script src="https://12345678-123.ch/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver=3.26.0-0' defer="defer"></scr" + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src="https://12345678-123.ch/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver=3.0.12' defer="defer"></scr" + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src="https://12345678-123.ch/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver=2.0.2' defer="defer"></scr" + 'ipt>' );

Any idea would be much appreciated.

3 Answers
3

Here is an answer: WordPress v5.0.3 Gutenberg & JS error “Uncaught SyntaxError: missing ) after argument list”

The simplest way: Find & delete PHP Hook which added ‘defer’ to script (in the function.php file). Or if you have skills you can edit the code of the hook. Reason: Confusion/conflict with quotes (‘ & “) witch break down JS.

About ‘defer’ you can read here: https://www.w3schools.com/tags/att_script_defer.asp This is probably due to speed optimization on your website.

Tags:

Leave a Reply

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