wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_get_script_tag › WordPress Function
Seit5.7.0
Veraltetn/v
› wp_get_script_tag ( $attributes )
| Parameter: |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Formats `<script>` loader tags.
It is possible to inject attributes in the<script> tag via the {@see 'wp_script_attributes'} filter.
Automatically injects type attribute if needed.Ähnliche Funktionen: wp_get_inline_script_tag, wp_print_script_tag, wp_get_post_tags, wp_set_post_tags, wp_get_script_polyfill
Quellcode
function wp_get_script_tag( $attributes ) {
/**
* Filters attributes to be added to a script tag.
*
* @since 5.7.0
*
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
* Only the attribute name is added to the `<script>` tag for
* entries with a boolean value, and that are true.
*/
$attributes = apply_filters( 'wp_script_attributes', $attributes );
return sprintf( "<script%s></script>\n", wp_sanitize_script_attributes( $attributes ) );
}