[wp-trac] [WordPress Trac] #22244: jQuery should register in footer by default
WordPress Trac
noreply at wordpress.org
Mon Mar 10 20:31:02 UTC 2014
#22244: jQuery should register in footer by default
-------------------------+----------------------
Reporter: ryanve | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Performance | Version:
Severity: normal | Resolution: wontfix
Keywords: 2nd-opinion | Focuses:
-------------------------+----------------------
Comment (by Marventus):
Hi, there. I apologize in advanced for reopening the discussion on a
17-month old ticket. Here's the thing: has anyone actually tried to force
jquery to load in the footer? Using latest wp-trunk version, TwentyTwelve
theme, and all plugins disabled, the following plugin fails to load jQuery
in the footer:
function tgi_jquery_in_footer_test() {
wp_register_script('tgi-jquery-js', "//some/uri/name.js",
array("jquery"), "0.1", true);
wp_enqueue_script('tgi-jquery-js');
}
add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
Even re-registering jquery with the same options and in_footer param set
to true doesn't seem to cut it:
function tgi_jquery_in_footer_test() {
wp_deregister_script("jquery");
wp_register_script("jquery", false, array("jquery-core", "jquery-
migrate"), "1.11", true);
wp_register_script('tgi-jquery-js', "//some/uri/name.js",
array("jquery"), "0.1", true);
wp_enqueue_script('tgi-jquery-js');
}
add_action('wp_enqueue_scripts', 'tgi_jquery_in_footer_test');
Could anyone try to replicate this?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22244#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list