Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_script_attributes

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2737      /**
2738       * Filters attributes to be added to a script tag.
2739       *
2740       * @since 5.7.0
2741       *
2742       * @param array $attributes Key-value pairs representing `<script>` tag attributes.
2743       *                          Only the attribute name is added to the `<script>` tag for
2744       *                          entries with a boolean value, and that are true.
2745       */
2746      $attributes = apply_filters( 'wp_script_attributes', $attributes );
2747
2748      return sprintf( "<script%s></script>\n", wp_sanitize_script_attributes( $attributes ) );
2749 }
2750
2751 /**
2752  * Prints formatted `<script>` loader tag.
2753  *
2754  * It is possible to inject attributes in the `<script>` tag via the  {@see 'wp_script_attributes'}  filter.
2755  * Automatically injects type attribute if needed.