wp_print_script_tag() WordPress Function
The wp_print_script_tag() function is used to print a script tag in the HTML document. This function is typically used to include a JavaScript file in the document.
wp_print_script_tag( array $attributes ) #
Prints formatted loader tag.
Description
It is possible to inject attributes in the <script>
tag via the ‘wp_script_attributes’ filter. Automatically injects type attribute if needed.
Parameters
- $attributes
(array)(Required)Key-value pairs representing
<script>
tag attributes.
Source
File: wp-includes/script-loader.php
function wp_print_script_tag( $attributes ) { echo wp_get_script_tag( $attributes ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.7.0 | Introduced. |