Marks the script module to be enqueued in the page.
Description
If a src is provided and the script module has not been registered yet, it will be registered.
Parameters
$idstring
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.Default: ''
$depsarrayoptional
Default: array()
$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
305publicfunctionenqueue(string$id,string$src='',array$deps=array(),$version=false,array$args=array()){306if(''===$id){307_doing_it_wrong(__METHOD__,__('Non-empty string required for id.'),'6.9.0');308return;309}310311if(!in_array($id,$this->queue,true)){312$this->queue[]=$id;313}314if(!isset($this->registered[$id])&&$src){315$this->register($id,$src,$deps,$version,$args);316}317}
History
Introduced in 6.5.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.9.7
Parameter $args added.verified against source
6.9.0
Added the $args parameter.from the docblock
6.5.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/class-wp-script-modules.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.