Uses
Uses | Description |
---|---|
wp-includes/formatting.php: esc_attr() | Escaping for HTML attributes. |
Prints inline scripts registered for a specific handle.
(string) (Required) Name of the script to add the inline script to. Must be lowercase.
(string) (Optional) Whether to add the inline script before the handle or after.
Default value: 'after'
(bool) (Optional) Whether to echo the script instead of just returning it.
Default value: true
(string|false) Script on success, false otherwise.
File: wp-includes/class.wp-scripts.php
public function print_inline_script( $handle, $position = 'after', $echo = true ) { $output = $this->get_data( $handle, $position ); if ( empty( $output ) ) { return false; } $output = trim( implode( "\n", $output ), "\n" ); if ( $echo ) { printf( "<script%s id='%s-js-%s'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), esc_attr( $position ), $output ); } return $output; }
Version | Description |
---|---|
4.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_scripts/print_inline_script