[wp-trac] [WordPress Trac] #35643: wp_enqueue_script() with an alias handle doesn't work in footer
WordPress Trac
noreply at wordpress.org
Tue Feb 2 21:08:23 UTC 2016
#35643: wp_enqueue_script() with an alias handle doesn't work in footer
--------------------------------------+--------------------
Reporter: kovshenin | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.5
Component: Script Loader | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+--------------------
Comment (by grapplerulrich):
Have you tried the patch with jQuery? I tried the patch with the following
snippet and it did not work.
{{{#!php
<?php
function grappler_move_jquery_to_footer( &$scripts ) {
if( is_admin() ) {
return;
}
$scripts->add_data( 'jquery', 'group', 1 );
$scripts->add_data( 'jquery-core', 'group', 1 );
$scripts->add_data( 'jquery-migrate', 'group', 1 );
}
add_action( 'wp_default_scripts', 'grappler_move_jquery_to_footer', 11 );
}}}
When I was trying to make it work I looked at
https://github.com/WordPress/WordPress/blob/4.4-branch/wp-includes/class
.wp-dependencies.php#L111. It adds the alias script to the header without
checking the group.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35643#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list