wp_print_inline_script_tag( string $javascript, array $attributes = array() )
Prints inline JavaScript wrapped in 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
- $javascript
-
(string) (Required) Inline JavaScript code.
- $attributes
-
(array) (Optional) Key-value pairs representing
<script>
tag attributes.Default value: array()
Source
File: wp-includes/script-loader.php
function wp_print_inline_script_tag( $javascript, $attributes = array() ) { echo wp_get_inline_script_tag( $javascript, $attributes ); }
Changelog
Version | Description |
---|---|
5.7.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_print_inline_script_tag