WPDev.one
Core Function
View Source on Trac ↗

wp_enqueue_script_module()

wp_enqueue_script_module( string $id, string $src = '', array $deps = array(), mixed $version = false )

Marks the script module to be enqueued in the page.

Parameters 4 required

Name / Type Description
string

$id The identifier of the script module. Should be unique. It will be used in the final import map.

Required
string

$src Optional. Full URL of the script module, or path of the script module relative to the WordPress root directory. If it is provided and the script module has not been registered yet, it will be registered.

Required
array

$deps { Optional. List of dependencies.

Required
mixed

(string | false | null) $version Optional. String specifying the script module version number. Defaults to false. It is added to the URL as a query string for cache busting purposes. If $version is set to false, the version number is the currently installed WordPress version. If $version is set to null, no version is added.

Required

Return Value

(void)
No return value description available.

Function Information

Since Version
6.5.0
Source File
wp-includes/script-modules.php
Advertisement