0
votes

I've been searching all over Stackoverflow about this issue but none of the solutions seem to work. I migrated an existing wordpress installation (database + files, same domain) to to another hosting. These are the errors i'm getting, all jquery related: Uncaught SyntaxError:

Invalid or unexpected token
Uncaught ReferenceError: jQuery is not defined

screenshot of errors in wp-admin

I tried to add "define('CONCATENATE_SCRIPTS', false);" to wp-config.php and add Jquery script tags directly to theme's header.php file

Can you please guide me with this problem?

Link to frontend: https://www.cartediem.be

Thanks!

1
It seems like the jquery file is currupted somehow (maybe during migration). Can you try and replace the "wp-admin" folder contents with the files from fresh wordpress download or relevant wordpress version. Perhaps that will solve your issue. - zipkundan
@zipkundan I replaced wp-admin folder with fresh files, but noticed no changes. Could it have something to do with permissions? - Lennert Ovaere
Did you happen to change the order of declaration of script dependencies. Javascript relies heavily on script execution order. If any scripts are referenced that require JQuery, before JQuery itself is defined (in sequential order), then the loaded script will complain that JQuery is not defined. - Asyranok
@Asyranok no, not that i know about. Should i try and add "wp_enqueue_script()"? I researched a bit about it and come to this - Lennert Ovaere

1 Answers

1
votes

Something is clearly wrong with your jquery.js (and probably not only that). it looks to me like some weird error with the charset of the filesystem. or a corrupted file/transfer, like zipkundan mentioned. But you said you replaced the files.

i copied the code of your jquery.js directly into the console. same error like you get.

then i copy the code of one of my installations (same jquery version) the same way, and it works.

Take a look at the screenshot, on the left is mine, on the right is yours. This MIGHT also be a problem when unzipping the installation or transferred files. try to upload the individual files via FTP.

enter image description here