WordPress at Your Fingertips
function is not described

WP_Scripts::print_inline_script() public WP 4.5.0

Prints inline scripts registered for a specific handle.

{} It's a method of the class: WP_Scripts{}

No Hooks.

Return

String|false. Script on success, false otherwise.

Usage

global $wp_scripts;
$wp_scripts->print_inline_script( $handle, $position, $echo );
$handle(string) (required)
Name of the script to add the inline script to. Must be lowercase.
$position(string)
Whether to add the inline script before the handle or after.
Default: 'after'
$echo(true|false)
Whether to echo the script instead of just returning it.
Default: true

Changelog

Since 4.5.0 Introduced.

Code of WP_Scripts::print_inline_script() WP 5.8.1

public function print_inline_script( $handle, $position = 'after', $echo = true ) {
	$output = $this->get_data( $handle, $position );

	if ( empty( $output ) ) {
		return false;
	}

	$output = trim( implode( "\n", $output ), "\n" );

	if ( $echo ) {
		printf( "<script%s id='%s-js-%s'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), esc_attr( $position ), $output );
	}

	return $output;
}