[ WordPress.org  ](https://wordpress.org/)

  * [ News  ](https://wordpress.org/news/)
  * [ Showcase  ](https://wordpress.org/showcase/)
  * [ Hosting  ](https://wordpress.org/hosting/)
  * Extend 
    * [ Themes  ](https://wordpress.org/themes/)
    * [ Plugins  ](https://wordpress.org/plugins/)
    * [ Patterns  ](https://wordpress.org/patterns/)
    * [ Blocks  ](https://wordpress.org/blocks/)
    * [ Openverse  ↗  ︎  ](https://openverse.org/)
  * Learn 
    * [ Learn WordPress  ](https://learn.wordpress.org/)
    * [ Documentation  ](https://wordpress.org/documentation/)
    * [ Forums  ](https://wordpress.org/support/forums/)
    * [ Developers  ](https://developer.wordpress.org/)
    * [ WordPress.tv  ↗  ︎  ](https://wordpress.tv/)
  * Community 
    * [ Make WordPress  ](https://make.wordpress.org/)
    * [ Photo Directory  ](https://wordpress.org/photos/)
    * [ Five for the Future  ](https://wordpress.org/five-for-the-future/)
    * [ Events  ](https://events.wordpress.org/)
    * [ Job Board  ↗  ︎  ](https://jobs.wordpress.net/)
  * About 
    * [ About WordPress  ](https://wordpress.org/about/)
    * [ Enterprise  ](https://wordpress.org/enterprise/)
    * [ Gutenberg  ↗  ︎  ](https://wordpress.org/gutenberg/)
    * [ Swag Store  ↗  ︎  ](https://mercantile.wordpress.org/)
  * [ Get WordPress  ](https://wordpress.org/download/)

Search in WordPress.org

[ Get WordPress ](https://wordpress.org/download/)

[ WordPress.org  ](https://wordpress.org/)

[ WordPress Developer Resources ](https://developer.wordpress.org)

WP_Scripts::get_inline_script_tag()

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

[ Home ](https://developer.wordpress.org) [ Reference
](https://developer.wordpress.org/reference/) [ Classes
](https://developer.wordpress.org/reference/classes/) [ WP_Scripts
](https://developer.wordpress.org/reference/classes/wp_scripts/)
WP_Scripts::get_inline_script_tag()

Search

#  WP_Scripts::get_inline_script_tag(  string  $handle  ,  string  $position
=  ‘after’  ):  string

##  In this article

Table of Contents

  * Parameters 
  * Return 
  * Source 
  * Related 
  * Changelog 

↑  Back to top

Gets tags for inline scripts registered for a specific handle.

##  Parameters

` $handle ` string  required

    

Name of the script to get associated inline script tag for.  
Must be lowercase.

` $position ` string  optional

    

Whether to get tag for inline scripts in the before or after position. Default
` 'after' ` .

Default: ` 'after' `

##  Return

string  Inline script, which may be empty string.

##  Source

    
    
    public function get_inline_script_tag( $handle, $position = 'after' ) {
    	$js = $this->get_inline_script_data( $handle, $position );
    	if ( empty( $js ) ) {
    		return '';
    	}
    
    	$id = "{$handle}-js-{$position}";
    
    	return wp_get_inline_script_tag( $js, compact( 'id' ) );
    }
    

[ 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.5/src/wp-includes/class-wp-
scripts.php#L538) [ View on GitHub ](https://github.com/WordPress/wordpress-
develop/blob/6.5/src/wp-includes/class-wp-scripts.php#L538-L547)

##  Related

Uses  |  Description   
---|---  
[ WP_Scripts::get_inline_script_data() ](https://developer.wordpress.org/reference/classes/wp_scripts/get_inline_script_data/) ` wp-includes/class-wp-scripts.php ` |  Gets data for inline scripts registered for a specific handle.   
[ wp_get_inline_script_tag() ](https://developer.wordpress.org/reference/functions/wp_get_inline_script_tag/) ` wp