Title: WP_Scripts::has_inline_script
Published: August 8, 2023
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Gets data for inline scripts registered for a specific handle.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#parameters)󠁿

 `$handle`stringrequired

Name of the script to get data for. Must be lowercase.

`$position`stringoptional

The position of the inline script.

Default:`null`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes_class-wp-scripts-php-2/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-scripts.php#L1145)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-scripts.php#L1145-L1151)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Scripts::filter_eligible_strategies()](https://developer.wordpress.org/reference/classes/wp_scripts/filter_eligible_strategies/)`wp-includes/class-wp-scripts.php` |

Filter the list of eligible loading strategies for a script.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_scripts/has_inline_script/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_scripts%2Fhas_inline_script%2F)
before being able to contribute a note or feedback.