Opened 6 years ago
Closed 4 years ago
#48273 closed defect (bug) (worksforme)
ReferenceError: jQuery is not defined
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | critical | Version: | |
Component: | Script Loader | Keywords: | reporter-feedback close |
Focuses: | Cc: |
Description
There is a bug in the latest version (Version 5.2.3), it's throwing:
ReferenceError: jQuery is not defined
All over the admin.
To reproduce:
- Setup a web server with Ubuntu, MySQL 5.7, PHP 7.2 and nginx 1.10 using a off-the-shelf wordpress config.
- wget https://wordpress.org/latest.tar.gz, extract
- chown -R www-data:www-data <wordpress install folder> and chmod -R g+rw <wordpress install folder>
- Copy wp-config-sample.php to wp-config.php
- Edit wp-config.php and edit ONLY DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST with the credentials for a MySQL user that has full access to the DB in question
- Visit site URL
- Select 'English', provide a username, password
- Login to new installation admin, notice that there are SEVEN fatal JS errors due to jQuery not defined issue
I discovered this on a live site because it broke the 'create page' functionality after an update. After installing a fresh copy with a fresh database I discovered that this is a bug in WordPress rather than a configuration issue.
Change History (8)
#2
@
6 years ago
Thanks for the report! However, I could not reproduce it either.
- Which browser are you using?
- Could you make sure jQuery is not blocked by a browser extension or antivirus software?
- What happens if you open the URL directly, e.g.
http://mysite.com/wp-includes/js/jquery/jquery.js
?
#4
@
6 years ago
Hi, I think I have the same issue.
Whenever I try to access 'all page' or 'all posts' menus, I get a broken layout. here are screenshots:
https://wetransfer.com/downloads/8a75b728e251f77600acefe6a411a44f20191017211156/331ebb
When I check the console, I get tens of 'jQuery is not defined' errors.
When I try to edit a post I get the error The editor has encountered an unexpected error
I deactivated all plugins through health-check plugin, used nineteen theme, reinstalled the last wordpress three times, and still got the error.
when I check site/wp-includes/js/jquery/jquery.js, I have a lot of code in the page, starting with:
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license | WordPress 2019-05-16 */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this .......
FI, I manage another wordpress site that does not have this issue.
#5
@
6 years ago
hi again, below more information:
- I deactivated security plugin wordfence and regenerated htaaccess (through settings>permalink>save).
- I can now access 'all pages' and 'all posts', both layouts looks normal, but I still have console errors: Uncaught TypeError: a.widget is not a function, Uncaught TypeError: jQuery(...).sortable is not a function,Uncaught TypeError: Cannot read property 'mouse' of undefined
- I still cannot edit posts and pages, and have the same error: The editor has encountered an unexpected error, with console error jQuery is not defined
- most menus are now broken, like dashboard, settings.
#6
@
6 years ago
@happy-pillz
Thanks for the additional information, are you able to check a few things to help diagnose the problem?
- Does the file
site/wp-includes/js/jquery/jquery.js
end withjQuery.noConflict();
? - Are you able to access
http://mysite.com/wp-includes/js/jquery/ui/sortable.min.js
directly? - Finally, could you please upload a screen shot of your console from the posts screen?
Thanks
Hi @bhartvigsen and welcome to trac!
I'm unable to reproduce this using 5.2.3, does the issue occur when using a default theme without any plugins enabled?
Many thanks,
Peter