_WP_Dependency::add_data() WordPress Method
The add_data() method of the WP_Dependency class is used to add data to a Dependency object. The first parameter is the data key, and the second parameter is the data value. The data key can be any string, but must be unique within the Dependency object. The data value can be any PHP data type, including arrays and objects.
_WP_Dependency::add_data( string $name, mixed $data ) #
Add handle data.
Contents
Parameters
- $name
(string)(Required)The data key to add.
- $data
(mixed)(Required)The data value to add.
Return
(bool) False if not scalar, true otherwise.
Source
File: wp-includes/class-wp-dependency.php
public function add_data( $name, $data ) { if ( ! is_scalar( $name ) ) { return false; } $this->extra[ $name ] = $data; return true; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |