W3cubDocs

/WordPress

wp_print_inline_script_tag( string $data, array $attributes = array() )

Prints an inline script 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

$datastringrequired
Data for script tag: JavaScript, importmap, speculationrules, etc.
$attributesarrayoptional
Key-value pairs representing <script> tag attributes.

Default:array()

Source

function wp_print_inline_script_tag( $data, $attributes = array() ) {
	echo wp_get_inline_script_tag( $data, $attributes );
}

Changelog

Version Description
5.7.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_print_inline_script_tag