#14488 closed defect (bug) (fixed)
wp_enqueue_script in_footer doesn't work on WP known scripts
Reported by: | mcr2582 | Owned by: | sorich87 |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | minor | Version: | 3.0.1 |
Component: | Script Loader | Keywords: | has-patch |
Focuses: | Cc: |
Description
I changed some plugin code from:
wp_enqueue_script('jquery-ui-sortable');
To:
wp_enqueue_script('jquery-ui-sortable',false,array(),false,true);
However, the script was not moved to the footer.
When I looked at the source for wp_enqueue_script, I can see that it's because the check for $in_footer is inside the condition for $src being defined. But built-in scripts don't require a source.
Attachments (2)
Change History (17)
#2
@
14 years ago
- Cc sorich87@… added
- Keywords has-patch added; JS footer enqueue removed
- Owner set to sorich87
- Status changed from new to accepted
#4
@
14 years ago
I think is_footer
is actually correct there. Would be nice to have this sorted out.
#12
follow-up:
↓ 13
@
10 years ago
This introduces a change which now throws notices when $handle is an array. Of course, the wp_enqueue_script and wp_enqueue_style functions are not documented to accept arrays, they may be (and have been) used as such -- even by at least one of the most popular plugins on wordpress.org.
Up until earlier this month in the trunk commit for 4.2 [31028], the unintended consequences of calling the following code were that multiple handles could be enqueued at once. Documentation in code and in codex says it's a string, but it threw no notices or errors, or doing it wrong's.
wp_enqueue_script( array( 'jquery', 'etc', 'etc2' ) );
With that, should a new ticket be opened up to add documented support for array as $handle in wp_enqueue_script and wp_enqueue_style, or would this ticket need to have a new patch applied which at minimal removes the notice that's introduced in 4.2 for undocumented use of arrays?
#13
in reply to:
↑ 12
@
10 years ago
Replying to sc0ttkclark:
This introduces a change which now throws notices when $handle is an array.
Related: #31636
Don't think
is_footer
is the right check.