Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19558 closed defect (bug) (invalid)

jQuery-ui core and others not being enqueued

Reported by: asfreema Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: General Keywords: needs-patch
Focuses: Cc:


I'm developing a theme and cannot enqueue any of the jquery-ui extensions (accordion, or core). I've tried multiple combinations of wp_enqueue_script calls. jQuery 1.7.1 loads fine, even when I only enqueue jquery-ui-core or jquery-ui-accordion, but those two never seem to load. I do have them in my wp-includes/js/jquery/ui/ folder.

This is my functions.php which can be used to simulate the problem:

<?php function meso_enqueue_scripts() {

add_action ( 'wp_enqueue_scripts', 'meso_enqueue_scripts');

My theme does have wp_head(); You can also try out jquery-ui-core, also including jquery, or any combination.

I fixed it by changing the definitions in wp-includes/script-loader.php that look like this:

	$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.8.16', 1 );

To this:

	$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.8.16' );

Seems like a problem with that add method and the extra argument (jquery and the other libraries don't have it), but I don't know the core well enough to find what it is.

Change History (3)

#1 @asfreema
6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Didn't know you needed wp_footer() for that.

My bad.

#2 @dd32
6 years ago

  • Milestone Awaiting Review deleted

#3 @azaozz
6 years ago

Yes, by default jQuery is loaded in the head and UI (all components) is loaded in the footer. The extra arg. is the equivalent of passing true as last arg. when enqueueing your own script.

When using UI on the front end it expects that the theme has a call to wp_footer() so it can load.

Note: See TracTickets for help on using tickets.