WP_Script_Modules::print_import_map()

In this article

Prints the import map using a script tag with a type=”importmap” attribute.

Source

public function print_import_map() {
	$import_map = $this->get_import_map();
	if ( ! empty( $import_map['imports'] ) ) {
		wp_print_inline_script_tag(
			wp_json_encode( $import_map, JSON_HEX_TAG | JSON_HEX_AMP ),
			array(
				'type' => 'importmap',
				'id'   => 'wp-importmap',
			)
		);
	}
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.