Registers a script to be enqueued later using the wp_enqueue_script() function.
Parameters
$handlestring
Name of the script. Should be unique.
$srcstring|false
Full URL of the script, or path of the script relative to the WordPress root directory. If source is set to false, script is an alias of other scripts it depends on.
$depsstring[]optional
An array of registered script handles this script depends on. Default empty array.Default: array()
$verstring|bool|nulloptional
String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added.Default: false
$argsarray|booloptional
An array of extra args for the script. Default empty array. Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.Default: array()
$strategystring
Optional. If provided, may be either 'defer' or 'async'.
$in_footerbooldefault: 'false'
Optional. Whether to print the script in the footer.
$fetchprioritystringdefault: 'auto'
Optional. The fetch priority for the script.
$module_dependenciesarray
Optional. IDs for module dependencies loaded via dynamic import. Default empty array. For the full data format, see the $deps param of wp_register_script_module(). When provided, the script must either be printed in the footer (with in_footer set to true) or use a deferred loading strategy (defer), so that the script modules import map is printed before the script is evaluated. Otherwise dynamic imports may fail to resolve.
Return
bool
Whether the script has been registered. True on success, false on failure.
Signature, return type and hooks compared across 5 parsed releases.
7.0.0
The $module_dependencies parameter of type string[] was added to the $args parameter of type array.from the docblock
6.9.0
The $fetchpriority parameter of type string was added to the $args parameter of type array.from the docblock
6.3.0
The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.from the docblock
4.3.0
A return value was added.from the docblock
2.1.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/functions.wp-scripts.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.