WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#20976 closed defect (bug) (duplicate)

jQuery loading last

Reported by: sccr410 Owned by:
Milestone: Priority: normal
Severity: critical Version: 3.4
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

After upgrading to 3.4, every piece of JavaScript on my site no longer worked. I was getting "jQuery not defined" errors. Looked into source code and now for some reason jQuery is the last of all enqueue'd scripts to be loaded. This means every plugin that loads JS and needs jQuery doesn't have it available when it is initially loaded. Something happened in this latest release because this has never been an issue before.

I can't upgrade any of my WP sites otherwise I have to redo the theme to manually insert jQuery which is not idea - want to use enqueue to make sure it doesn't get loaded twice.

Change History (7)

#2 @nacin
7 years ago

Yes, almost definitely #20971.

#3 @sccr410
7 years ago

Am I doing something wrong in my themes using wp_enqueue_script('jquery') and then wp_head() (because I need jQuery for my theme) or is it the plugin developers that are doing things wrong? Just want to make sure I am doing things right for future releases of WP!

#4 @georgestephanis
7 years ago

  • Cc George@… added

Out of curiosity, do you have jQuery set as a dependency for your other scripts that need it?

#5 @sccr410
7 years ago

It is JavaScript from plugins, so I don't have control over that. While plugin authors should be doing this, it appears not many do. So I don't know if this would be considered a bug or 90% of plugins need to be updated to set jQuery as a dependency.

#6 @MikeHansenMe
7 years ago

  • Keywords close added

As George said scripts requiring jQuery should have jQuery as a dependency. Proposing close

#7 @SergeyBiryukov
7 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #20971.

Note: See TracTickets for help on using tickets.