Gets data for inline scripts registered for a specific handle.
$handlestringrequired
$positionstringoptional
'after'.Default:'after'
public function get_inline_script_data( $handle, $position = 'after' ) {
$data = $this->get_data( $handle, $position );
if ( empty( $data ) || ! is_array( $data ) ) {
return '';
}
return trim( implode( "\n", $data ), "\n" );
}
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_scripts/get_inline_script_data