wp_print_inline_script_tag( string $data, $attributes = array() )
- Since
- 5.7.0
- Source
wp-includes/script-loader.php:3079
Prints an inline script tag.
Description
It is possible to inject attributes in the
<script> tag via the 'wp_inline_script_attributes' filter.Automatically injects type attribute if needed.Parameters
$datastring- Data for script tag: JavaScript, importmap, speculationrules, etc.
$attributesoptional- Default:
array()
Uses · 1
- wp_get_inline_script_tag()Constructs an inline script tag.
Used by · 32
- Twenty_Twenty_One_Dark_Mode::the_script()Prints the dark-mode switch script.
- WP_Customize_Manager::customize_pane_settings()Prints JavaScript settings for parent window.
- WP_Customize_Manager::customize_preview_settings()Prints JavaScript settings for preview frame.
- WP_Customize_Manager::remove_frameless_preview_messenger_channel()Removes customize_messenger_channel query parameter from the preview window when it is not in an iframe.
- WP_Customize_Nav_Menus::export_preview_data()Exports data from PHP to JS.
- WP_Customize_Selective_Refresh::export_preview_data()Exports data in preview after it has finished rendering so that partials can be added at runtime.
- WP_Customize_Widgets::export_preview_data()Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp_footer,
- WP_Script_Modules::print_import_map()Prints the import map using a script tag with a type="importmap" attribute.
- WP_Script_Modules::print_script_module_data()Print data associated with Script Modules.
- WP_Script_Modules::print_script_module_translations()Prints translations for all enqueued script modules.
- WP_Scripts::print_extra_script()Prints extra scripts of a registered script.
- WP_Scripts::print_translations()Prints translations set for a specific handle.
Show all 32
- WP_Widget_Archives::widget()Outputs the content for the current Archives widget instance.
- WP_Widget_Categories::widget()Outputs the content for the current Categories widget instance.
- _print_emoji_detection_script()Prints inline Emoji detection script.
- _print_scripts()Prints scripts (internal use only)
- login_footer()Outputs the footer for the login page.
- login_header()Outputs the login page header.
- print_embed_scripts()Prints the JavaScript in the embed iframe header.
- twenty_twenty_one_supports_js()Removes the `no-js` class from body if JS is supported.
- twentyfifteen_color_scheme_css_template()Outputs an Underscore template for generating CSS for the color scheme.
- twentyfifteen_javascript_detection()JavaScript Detection.
- twentyseventeen_javascript_detection()Handles JavaScript detection.
- twentysixteen_color_scheme_css_template()Outputs an Underscore template for generating CSS for the color scheme.
- twentysixteen_javascript_detection()Handles JavaScript detection.
- twentytwenty_no_js_class()Adds 'no-js' class.
- twentytwentyone_add_ie_class()Adds "is-IE" class to body if the user is on Internet Explorer.
- wp_comment_form_unfiltered_html_nonce()Displays form token for unfiltered comments.
- wp_customize_support_script()Prints a script to check whether or not the Customizer is supported, and apply either the no-customize-support or customize-support class to the body.
- wp_post_preview_js()Outputs a small JS snippet on preview tabs/windows to remove `window.name` when a user is navigating to another page.
- wp_print_speculation_rules()Prints the speculation rules.
- wp_shake_js()Outputs the JavaScript to handle the form shaking on the login page.
Source
function wp_print_inline_script_tag( $data, $attributes = array() ) { echo wp_get_inline_script_tag( $data, $attributes );}History
Introduced in 5.7.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Parameter
$attributes retyped from array to untyped.verified against source5.7.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.