Marks the script module to be enqueued in the page.
If a src is provided and the script module has not been registered yet, it will be registered.
$idstringrequired
$srcstringoptional
Default:''
$depsarrayoptional
...$0 string|arrayid key with the script module identifier, and can contain an import key with either static or dynamic. By default, dependencies that don’t contain an import key are considered static.id stringimport stringstatic or dynamic. Defaults to static.Default:array()
$versionstring|false|nulloptional
Default:false
function wp_enqueue_script_module( string $id, string $src = '', array $deps = array(), $version = false ) {
wp_script_modules()->enqueue( $id, $src, $deps, $version );
}
| Version | Description |
|---|---|
| 6.5.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_enqueue_script_module