WordPress at Your Fingertips

wp_script_add_data() WP 1.0

Add metadata to a script.

Works only if the script has already been added.

Possible values for $key and $value: 'conditional' string Comments for IE 6, lte IE 7, etc.

No Hooks.


true|false. True on success, false on failure.


wp_script_add_data( $handle, $key, $value );
$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.



Since 4.2.0 Introduced.

Code of wp_script_add_data() WP 5.8

function wp_script_add_data( $handle, $key, $value ) {
	return wp_scripts()->add_data( $handle, $key, $value );

From tag: script

More from category: Scripts and Styles

No comments
    Log In