WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 months ago

#14488 accepted defect (bug)

wp_enqueue_script in_footer doesn't work on WP known scripts

Reported by: mcr2582 Owned by: sorich87
Milestone: Future Release 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)

14488.diff (616 bytes) - added by sorich87 4 years ago.
14488.patch (650 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 nacin4 years ago

  • Milestone changed from Awaiting Review to 3.1

sorich874 years ago

comment:2 sorich874 years ago

  • Cc sorich87@… added
  • Keywords has-patch added; JS footer enqueue removed
  • Owner set to sorich87
  • Status changed from new to accepted

comment:3 nacin3 years ago

  • Milestone changed from 3.1 to Future Release

Don't think is_footer is the right check.

comment:4 mitchoyoshitaka3 years ago

I think is_footer is actually correct there. Would be nice to have this sorted out.

SergeyBiryukov3 years ago

comment:5 SergeyBiryukov3 years ago

Simplified the patch a bit.

comment:6 MikeHansenMe18 months ago

tested and confirmed the patch works.

comment:7 MikeHansenMe18 months ago

  • Cc mdhansen@… added

comment:8 valeriosza6 months ago

I think closing the valid ticket.

comment:9 nacin3 months ago

  • Component changed from General to Script Loader
Note: See TracTickets for help on using tickets.