wp_get_script_tag

函数


wp_get_script_tag ( $attributes )
参数
  • (array)
    $attributes
    Key-value pairs representing `
返回值
  • (string) String containing `
定义位置
  • wp-includes/script-loader.php
    , line 2733
引入
5.7.0
弃用

Formats `

It is possible to inject attributes in the “ tag via the {@see ‘wp_script_attributes’} filter.
Automatically injects type attribute if needed.

function wp_get_script_tag( $attributes ) {
	if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) {
		$attributes['type'] = 'text/javascript';
	}
	/**
	 * Filters attributes to be added to a script tag.
	 *
	 * @since 5.7.0
	 *
	 * @param array $attributes Key-value pairs representing `n", wp_sanitize_script_attributes( $attributes ) );
}