Registers the script module if no script module with that script module identifier has already been registered.
Parameters
$idstringrequired- The identifier of the script module. Should be unique. It will be used in the final import map.
$srcstringoptional- 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.
string|bool> $args { Optional. An array of additional args. Default empty array.
@type bool $in_footer Whether to print the script module in the footer. Only relevant to block themes. Default'false'. Optional.
@type$fetchpriority Fetch priority. Default'auto'|'low'|'high''auto'. Optional.
}$versionstring|false|nulloptional- 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.Default:
false
Source
function wp_register_script_module( string $id, string $src, array $deps = array(), $version = false, array $args = array() ) {
wp_script_modules()->register( $id, $src, $deps, $version, $args );
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.