WP_Styles::add_data
Overrides the add_data method from WP_Dependencies, to allow unsetting dependencies for conditional styles.
Method of the class: WP_Styles{}
No Hooks.
Returns
true|false. True on success, false on failure.
Usage
global $wp_styles; $wp_styles->add_data( $handle, $key, $value );
- $handle(string) (required)
- Name of the item. Should be unique.
- $key(string) (required)
- The data key.
- $value(mixed) (required)
- The data value.
Changelog
| Since 6.9.0 | Introduced. |
WP_Styles::add_data() WP Styles::add data code WP 6.9.1
public function add_data( $handle, $key, $value ) {
if ( ! isset( $this->registered[ $handle ] ) ) {
return false;
}
if ( 'conditional' === $key ) {
$this->registered[ $handle ]->deps = array();
}
return parent::add_data( $handle, $key, $value );
}