WP_Scripts::print_extra_script( string $handle, bool $echo = true )

Prints extra scripts of a registered script.


Parameters

$handle

(Required) The script's registered handle.

$echo

(Optional) Whether to echo the extra script instead of just returning it.

Default value: true


Return

(bool|string|void) Void if no data exists, extra scripts if $echo is true, true otherwise.


Source

File: wp-includes/class.wp-scripts.php

	public function print_extra_script( $handle, $echo = true ) {
		if ( !$output = $this->get_data( $handle, 'data' ) )
			return;

		if ( !$echo )
			return $output;

		echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
		echo "/* <![CDATA[ */\n";
		echo "$output\n";
		echo "/* ]]> */\n";
		echo "</script>\n";

		return true;
	}


Changelog

Changelog
Version Description
WP-3.3.0 Introduced.