Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_inline_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
2782       * Filters attributes to be added to a script tag.
2783       *
2784       * @since 5.7.0
2785       *
2786       * @param array  $attributes Key-value pairs representing `<script>` tag attributes.
2787       *                           Only the attribute name is added to the `<script>` tag for
2788       *                           entries with a boolean value, and that are true.
2789       * @param string $javascript Inline JavaScript code.
2790       */
2791      $attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $javascript );
2792
2793      $javascript = "\n" . trim( $javascript, "\n\r " ) . "\n";
2794
2795      return sprintf( "<script%s>%s</script>\n", wp_sanitize_script_attributes( $attributes ), $javascript );
2796 }
2797
2798 /**
2799  * Prints inline JavaScript wrapped in `<script>` tag.
2800  *