Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Class Reference/ WP Dependency


_WP_Dependency is a class defined in wp-includes/class.wp-dependencies.php that holds information about an items in a WP_Dependencies queue. This class is internal to WP_Dependencies.

Args vs Extra

There are two different properties that hold additional information for an item: $args and $extra. The former is a scalar that holds registration data (data provided when the item was added to the dependency queue). For example, $args for WP_Styles holds the stylesheet media, whereas for WP_Scripts, it's a dependency group. $extra is an array that holds arbitrary data added via add_data(). For example, it can hold the title of a stylesheet or raw style rules.

Methods and Properties


item identifier.
URL associated with item (in practice, items are web resources).
handles of other items that this items depends on.
$ver = FALSE 
version for item
$args = NULL 
extra information provided when item was registered.
Array of extra data.


bool add_data( $key, $value ) 
Adds extra data to an item.
bool all_deps( $handles, $recursion = false, $group = false ) 
Recursively builds an array of items to process while taking dependencies into account.
bool add( $handle, $src, $deps = array(), $ver = false, $args = null ) 
Registers an item if no item of that name already exists
string get_data( $handle, $key ) 
Gets data associated with a registered item
void remove ( $handles ) 
Unregister an item or items


Change Log

Since 2.6.

Source File

_WP_Dependency is located in wp-includes/class.wp-dependencies.php.

See also index of Class Reference and index of Function Reference.