WordPress at a glance

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.

Return

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

Usage

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.

Notes

  • See: WP_Dependencies::add_data()

Changelog

Since 4.2.0 Introduced.

Code of wp script add data: wp-includes/functions.wp-scripts.php WP 5.2.2

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

Related Functions

From tag: script

More from category: Scripts and Styles

No comments
    Hello, !     Log In . Register