Ticket #41990: 41990.diff
File 41990.diff, 1.2 KB (added by , 12 months ago) |
---|
-
wp-includes/class-wp-scripts.php
134 134 private $type_attr = ''; 135 135 136 136 /** 137 * Holds an array of script handles whose extras still need to run. 138 * 139 * Any add_inline_script() 'after' scripts that were added during 140 * runtime and missed the wp_print_scripts action. These will be 141 * fired off in the footer at the end of the script process. 142 * 143 * @since 6.3.0 144 * @var array 145 */ 146 private $deferred_extras = array(); 147 148 /** 137 149 * Constructor. 138 150 * 139 151 * @since 2.6.0 … … 433 445 434 446 if ( 'after' !== $position ) { 435 447 $position = 'before'; 448 } else if ( did_action( 'wp_print_scripts' ) ) { 449 $this->deferred_extras[ $handle ] = $position; 436 450 } 437 451 438 452 $script = (array) $this->get_data( $handle, $position ); … … 686 700 */ 687 701 public function do_footer_items() { 688 702 $this->do_items( false, 1 ); 703 704 foreach ( $this->deferred_extras as $handle => $position ) { 705 $this->print_inline_script( $handle, 'after', true ); 706 } 707 689 708 return $this->done; 690 709 } 691 710