W3cubDocs

/WordPress

WP_Scripts::has_inline_script( string $handle, string $position = null ): bool

Gets data for inline scripts registered for a specific handle.

Parameters

$handlestringrequired
Name of the script to get data for. Must be lowercase.
$positionstringoptional
The position of the inline script.

Default:null

Return

bool Whether the handle has an inline script (either before or after).

Source

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' ) );
}

Changelog

Version Description
6.3.0 Introduced.

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