WP_Scripts::get_inline_script_tag()publicWP 6.3.0

Gets tags for inline scripts registered for a specific handle.

Метод класса: WP_Scripts{}

Хуков нет.

Возвращает

Строку. Inline script, which may be empty string.

Использование

global $wp_scripts;
$wp_scripts->get_inline_script_tag( $handle, $position );
$handle(строка) (обязательный)
Name of the script to get associated inline script tag for. Must be lowercase.
$position(строка)
Whether to get tag for inline scripts in the before or after position.
По умолчанию: 'after'

Список изменений

С версии 6.3.0 Введена.

Код WP_Scripts::get_inline_script_tag() WP 6.8

public function get_inline_script_tag( $handle, $position = 'after' ) {
	$js = $this->get_inline_script_data( $handle, $position );
	if ( empty( $js ) ) {
		return '';
	}

	$id = "{$handle}-js-{$position}";

	return wp_get_inline_script_tag( $js, compact( 'id' ) );
}