Make WordPress Core

Opened 17 months ago

Closed 7 weeks ago

#48273 closed defect (bug) (worksforme)

ReferenceError: jQuery is not defined

Reported by: bhartvigsen Owned by:
Milestone: Priority: normal
Severity: critical Version:
Component: Script Loader Keywords: reporter-feedback close
Focuses: Cc:


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)

#1 @peterwilsoncc
17 months ago

  • Keywords reporter-feedback added

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,

#2 @SergeyBiryukov
17 months ago

Thanks for the report! However, I could not reproduce it either.

  1. Which browser are you using?
  2. Could you make sure jQuery is not blocked by a browser extension or antivirus software?
  3. What happens if you open the URL directly, e.g. http://mysite.com/wp-includes/js/jquery/jquery.js?

#3 @SergeyBiryukov
17 months ago

  • Component changed from General to Script Loader

#4 @happy-pillz
17 months 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:

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 @happy-pillz
17 months 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 @peterwilsoncc
17 months ago


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 with jQuery.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?


#7 @Hareesh Pillai
2 months ago

  • Keywords close added

Hi @bhartvigsen and @happy-pillz,

I'm unable to reproduce the error either. Can you confirm if you still have the reported issue? If so, please share the details asked above so that it can be diagnosed.


#8 @hellofromTonya
7 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm closing this ticket. However, if the problem persists, please reopen and provide more information to help us further investigate.

Note: See TracTickets for help on using tickets.