WP_Script_Modules::print_enqueued_script_modules()publicWP 6.5.0

Prints the enqueued script modules using script tags with type="module" attributes.

Method of the class: WP_Script_Modules{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Script_Modules = new WP_Script_Modules();
$WP_Script_Modules->print_enqueued_script_modules();

Changelog

Since 6.5.0 Introduced.

WP_Script_Modules::print_enqueued_script_modules() code WP 6.6.2

public function print_enqueued_script_modules() {
	foreach ( $this->get_marked_for_enqueue() as $id => $script_module ) {
		wp_print_script_tag(
			array(
				'type' => 'module',
				'src'  => $this->get_src( $id ),
				'id'   => $id . '-js-module',
			)
		);
	}
}