Apply a filter to the `<script>` tag for enqueued scripts in the same way a filter is applied to the `<link>` tag for enqueued styles.
Fixes #13592 Props quietnic, MikeHansenMe Built from https://develop.svn.wordpress.org/trunk@30403 git-svn-id: http://core.svn.wordpress.org/trunk@30398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e2339bdb1b
commit
d0b10b5022
|
@ -138,10 +138,24 @@ class WP_Scripts extends WP_Dependencies {
|
||||||
if ( ! $src )
|
if ( ! $src )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( $this->do_concat )
|
$tag = "<script type='text/javascript' src='$src'></script>\n";
|
||||||
$this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
|
|
||||||
else
|
/**
|
||||||
echo "<script type='text/javascript' src='$src'></script>\n";
|
* Filter the HTML script tag of an enqueued script.
|
||||||
|
*
|
||||||
|
* @since 4.1.0
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
$tag = apply_filters( 'script_loader_tag', $tag, $handle, $src );
|
||||||
|
|
||||||
|
if ( $this->do_concat ) {
|
||||||
|
$this->print_html .= $tag;
|
||||||
|
} else {
|
||||||
|
echo $tag;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue