Make WordPress Core

Opened 14 months ago

Last modified 12 days ago

#44484 assigned defect (bug)

Mediaelement scripts forced loaded in header

Reported by: Themezly Owned by: joemcgill
Milestone: 5.3 Priority: normal
Severity: major Version: 4.9.6
Component: Media Keywords: needs-patch
Focuses: performance Cc:


Before this https://make.wordpress.org/core/2017/10/30/mediaelement-upgrades-in-wordpress-4-9/

media element scripts were loading where called


wp_enqueue_script( 'wp-mediaelement' ); // loads above site-scripts in footer with dependencies 


wp_enqueue_script( 'site-scripts'); // loads in footer as needed



load in head and wp-mediaelement.min.js loads in footer

If I call them one by one without calling wp-mediaelement the order is kept

wp_enqueue_script( 'mediaelement-migrate' );// loads in footer
wp_enqueue_script( 'mediaelement-core' );// loads in footer
wp_enqueue_script( 'site-scripts'); // loads in footer

if you look here it is intended for all of them to be in footer



but wp_enqueue_script( 'wp-mediaelement' );

depends on wp_enqueue_script( 'mediaelement' ); http://prntscr.com/k15288


which loads in header only

so we can never move the scripts to footer where they should be

If I set the mediaelement to load in footer everything works as intended.

Change History (4)

#1 @SergeyBiryukov
14 months ago

  • Component changed from General to Media

#2 @joemcgill
4 months ago

  • Focuses performance added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.3

Hi @Themezly,

Thanks for the report. This does seem to be an unintentional change from [41877]. I'm going to set this to the next major release, but we might be able to put it out in a 5.2.x release, if it's ready.

This ticket was mentioned in Slack in #core-media by mike. View the logs.

12 days ago

#4 @mikeschroder
12 days ago

  • Owner set to joemcgill
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.