Skip to content

Commit

Permalink
Yet another script position movement
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed Jan 12, 2024
1 parent 737a227 commit c454a02
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/compat/wordpress-6.5/class-wp-script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,15 @@ public function dequeue( $module_id ) {
* @since 6.5.0
*/
public function add_hooks() {
$module_position = wp_is_block_theme() ? 'wp_head' : 'wp_footer';
add_action( $module_position, array( $this, 'print_import_map' ) );
add_action( $module_position, array( $this, 'print_enqueued_modules' ) );
add_action( $module_position, array( $this, 'print_module_preloads' ) );
if ( wp_is_block_theme() ) {
add_action( 'wp_head', array( $this, 'print_import_map' ) );
add_action( 'wp_head', array( $this, 'print_enqueued_modules' ) );
add_action( 'wp_head', array( $this, 'print_module_preloads' ) );
} else {
add_action( 'wp_footer', array( $this, 'print_import_map' ) );
add_action( 'wp_footer', array( $this, 'print_module_preloads' ) );
add_action( 'wp_footer', array( $this, 'print_enqueued_modules' ) );
}
}

/**
Expand Down

0 comments on commit c454a02

Please sign in to comment.