WP_Scripts::has_inline_script()privateWP 6.3.0

Gets data for inline scripts registered for a specific handle.

Method of the class: WP_Scripts{}

No Hooks.

Return

true|false. Whether the handle has an inline script (either before or after).

Usage

// private - for code of main (parent) class only
$result = $this->has_inline_script( $handle, $position );
$handle(string) (required)
Name of the script to get data for. Must be lowercase.
$position(string)
The position of the inline script.
Default: null

Changelog

Since 6.3.0 Introduced.

WP_Scripts::has_inline_script() code WP 6.6.1

private function has_inline_script( $handle, $position = null ) {
	if ( $position && in_array( $position, array( 'before', 'after' ), true ) ) {
		return (bool) $this->get_data( $handle, $position );
	}

	return (bool) ( $this->get_data( $handle, 'before' ) || $this->get_data( $handle, 'after' ) );
}