Summery Summery
Register an item.
Syntax Syntax
Description Description
Registers the item if no item of that name already exists.
Parameters Parameters
- $handle
-
(Required) Name of the item. Should be unique.
- $src
-
(Required) Full URL of the item, or path of the item relative to the WordPress root directory. If source is set to false, item is an alias of other items it depends on.
- $deps
-
(Optional) An array of registered item handles this item depends on.
Default value: array()
- $ver
-
(Optional) String specifying item 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 value: false
- $args
-
(Optional) Custom property of the item. NOT the class property $args. Examples: $media, $in_footer.
Default value: null
Return Return
(bool) Whether the item has been registered. True on success, false on failure.
Source Source
File: wp-includes/class.wp-dependencies.php
* Examples: $media, $in_footer. * @return bool Whether the item has been registered. True on success, false on failure. */ public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { if ( isset( $this->registered[ $handle ] ) ) { return false; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Moved from WP_Scripts . |
2.1.0 | Introduced. |