Title: wp_print_script_tag
Published: March 9, 2021
Last modified: August 20, 2026

---

# wp_print_script_tag( $attributes )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#changelog)

Prints formatted  loader tag.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_print_script_tag/?output_format=md#description)󠁿

It is possible to inject attributes in the `<script>` tag via the [‘wp_script_attributes’](https://developer.wordpress.org/reference/hooks/wp_script_attributes/)
filter.
Automatically injects type attribute if needed.

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

`string|bool`> $attributes Key-value pairs representing `<script>` tag attributes.

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

    ```php
    function wp_print_script_tag( $attributes ) {
    	echo wp_get_script_tag( $attributes );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/script-loader.php#L2991)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/script-loader.php#L2991-L2993)

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

| Uses | Description | 
| [wp_get_script_tag()](https://developer.wordpress.org/reference/functions/wp_get_script_tag/)`wp-includes/script-loader.php` |

Formats  loader tags.

  |

| Used by | Description | 
| [WP_Script_Modules::print_script_module()](https://developer.wordpress.org/reference/classes/wp_script_modules/print_script_module/)`wp-includes/class-wp-script-modules.php` |

Prints the enqueued script module using script tags with type=”module” attributes.

  |

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

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

## User Contributed Notes

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