wp_script_add_data( string $handle, string $key, mixed $value ): bool
Adds metadata to a script.
Contents
Description
Works only if the script has already been registered.
Possible values for $key and $value: ‘conditional’ string Comments for IE 6, lte IE 7, etc.
See also
Parameters
-
$handle
string Required -
Name of the script.
-
$key
string Required -
Name of data point for which we're storing a value.
-
$value
mixed Required -
String containing the data to be added.
Return
bool True on success, false on failure.
Source
File: wp-includes/functions.wp-scripts.php
.
View all references
function wp_script_add_data( $handle, $key, $value ) {
return wp_scripts()->add_data( $handle, $key, $value );
}
Changelog
Version | Description |
---|---|
4.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Enqueue IE-specific Scripts with conditional comments
Add IE-specific CDN Scripts with conditional comments
Top ↑
Feedback
Add async/defer attribute to a script
— By Sharif Mohammad Eunus —