On this page
wp_script_add_data( string $handle, string $key, mixed $value ): bool
Add metadata to a script.
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
$handlestring Required-
Name of the script.
$keystring Required-
Name of data point for which we're storing a value.
$valuemixed 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 );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_scripts() wp-includes/functions.wp-scripts.php | Initialize $wp_scripts if it has not been set. |
Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_script_add_data