wp_print_inline_script_tag() WordPress Function

The wp_print_inline_script_tag() function is used to print inline JavaScript code in a WordPress page. This function is used to print inline JavaScript code in a WordPress page.

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.


Top ↑

Parameters

$javascript

(string)(Required)Inline JavaScript code.

$attributes

(array)(Optional) Key-value pairs representing <script> tag attributes.

Default value: array()


Top ↑

Source

File: wp-includes/script-loader.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More