[wp-trac] [WordPress Trac] #63179: Dependencies should load in the footer if the script is loaded in the footer

WordPress Trac noreply at wordpress.org
Wed Mar 26 14:29:02 UTC 2025


#63179: Dependencies should load in the footer if the script is loaded in the
footer
---------------------------+-----------------------------
 Reporter:  kkmuffme       |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Followup to https://core.trac.wordpress.org/ticket/35956


 {{{#!php
 <?php
 wp_register_script('parent','parent.js', array('child'), '1', array(
 'in_footer' => true ) );
 wp_register_script('child', 'child.js', array(), '1' );
 wp_enqueue_script('parent');
 }}}

 This will print "child" in head, but parent in the footer.
 But child should print in the footer too I guess, since it's just loaded
 as dependency?

 I assume this is bc of https://github.com/WordPress/wordpress-
 develop/blob/trunk/src/wp-includes/class-wp-scripts.php#L314C6-L314C22
 with docs:
 >3. The intended strategy is delayed.

 Why does the intended strategy matter here for the dependency?
 Removing that condition should fix it (not tested, just assuming it from
 what I see in the code)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63179>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list