WP_Scripts::get_inline_script_data()publicWP 6.3.0

Gets data 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_data( $handle, $position );
$handle(строка) (обязательный)
Name of the script to get data for. Must be lowercase.
$position(строка)
Whether to add the inline script before the handle or after.
По умолчанию: 'after'

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

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

Код WP_Scripts::get_inline_script_data() WP 6.7.2

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" );
}