script_loader_tag filter-hookWP 4.1.0

Filters the HTML script tag of an enqueued script.

Usage

add_filter( 'script_loader_tag', 'wp_kama_script_loader_tag_filter', 10, 3 );

/**
 * Function for `script_loader_tag` filter-hook.
 * 
 * @param string $tag    The `<script>` tag for the enqueued script.
 * @param string $handle The script's registered handle.
 * @param string $src    The script's source URL.
 *
 * @return string
 */
function wp_kama_script_loader_tag_filter( $tag, $handle, $src ){

	// filter...
	return $tag;
}
$tag(string)
The <script> tag for the enqueued script.
$handle(string)
The script's registered handle.
$src(string)
The script's source URL.

Changelog

Since 4.1.0 Introduced.

Where the hook is called

WP_Scripts::do_item()
script_loader_tag
wp-includes/class.wp-scripts.php 406
$tag = apply_filters( 'script_loader_tag', $tag, $handle, $src );

Where the hook is used in WordPress

Usage not found.