wp-includes/script-loader.php:2878Formats <script> loader tags.
$attributesarraystringOne hook fires while wp_get_script_tag() runs, in this order:
Filters attributes to be added to a script tag.
function wp_get_script_tag( $attributes ) { if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { // Keep the type attribute as the first for legacy reasons (it has always been this way in core). $attributes = array_merge( array( 'type' => 'text/javascript' ), $attributes ); } /** * Filters attributes to be added to a script tag. * * @since 5.7.0 * * @param array $attributes Key-value pairs representing `<script>` tag attributes. * Only the attribute name is added to the `<script>` tag for * entries with a boolean value, and that are true. */ $attributes = apply_filters( 'wp_script_attributes', $attributes ); return sprintf( "<script%s></script>\n", wp_sanitize_script_attributes( $attributes ) );}Introduced in 5.7.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$attributes retyped from array to untyped.verified against sourcesrc/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.