Summery Summery
Prints the styles that were queued too late for the HTML head.
Syntax Syntax
Return Return
(array|void)
Source Source
File: wp-includes/script-loader.php
* Used by {@see wp_get_script_tag()} and {@see wp_get_inline_script_tag()}. * * @since 5.7.0 * * @param array $attributes Key-value pairs representing `<script>` tag attributes. * @return string String made of sanitized `<script>` tag attributes. */ function wp_sanitize_script_attributes( $attributes ) { $html5_script_support = ! is_admin() && ! current_theme_supports( 'html5', 'script' ); $attributes_string = ''; // If HTML5 script tag is supported, only the attribute name is added // to $attributes_string for entries with a boolean value, and that are true. foreach ( $attributes as $attribute_name => $attribute_value ) { if ( is_bool( $attribute_value ) ) { if ( $attribute_value ) { $attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . $attribute_name; } } else { $attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); } } return $attributes_string; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |