# wp_add_inline_style()

URL: https://chugunov.pro/api-wordpress/functions/wp_add_inline_style/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 3.3.0.

## Сигнатура

```php
wp_add_inline_style( string $handle, string $data ): bool
```

## Описание

Styles will only be added if the stylesheet is already in the queue.
Accepts a string $data containing the CSS. If two or more CSS code blocks are added to the same stylesheet $handle, they will be printed in the order they were added, i.e. the latter added styles can redeclare the previous.[See also](#see-also)
- [WP_Styles::add_inline_style()](https://developer.wordpress.org/reference/classes/WP_Styles/add_inline_style/)

## Параметры

- `$handle` `string` — обязательный. Имя таблицы стилей, к которой добавляются дополнительные стили.
- `$data` `string` — обязательный. Строка, содержащая добавляемые CSS-стили.

## Возвращаемое значение

`bool`

## Исходный код

Файл: `wp-includes/functions-wp-styles.php:87`

```php
function wp_add_inline_style( $handle, $data ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	if ( false !== stripos( $data, '</style>' ) ) {
		_doing_it_wrong(
			__FUNCTION__,
			sprintf(
				/* translators: 1: <style>, 2: wp_add_inline_style() */
				__( 'Do not pass %1$s tags to %2$s.' ),
				'<code>&lt;style&gt;</code>',
				'<code>wp_add_inline_style()</code>'
			),
			'3.7.0'
		);
		$data = trim( (string) preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
	}

	return wp_styles()->add_inline_style( $handle, $data );
}
```

## История изменений

- 3.3.0 — Introduced.

## Связанные

Использует: [`stripos`](https://chugunov.pro/api-wordpress/functions/stripos/), [`wp_styles`](https://chugunov.pro/api-wordpress/functions/wp_styles/), `WP_Styles::add_inline_style`, [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`_doing_it_wrong`](https://chugunov.pro/api-wordpress/functions/_doing_it_wrong/).
Используется в: [`wp_hoist_late_printed_styles`](https://chugunov.pro/api-wordpress/functions/wp_hoist_late_printed_styles/), [`wp_enqueue_img_auto_sizes_contain_css_fix`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_img_auto_sizes_contain_css_fix/), `WP_Interactivity_API::data_wp_router_region_processor`, [`wp_enqueue_emoji_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_emoji_styles/), [`wp_enqueue_admin_bar_bump_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_admin_bar_bump_styles/), [`wp_enqueue_admin_bar_header_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_admin_bar_header_styles/), [`wp_enqueue_embed_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_embed_styles/), `WP_Duotone::output_global_styles`, `WP_Duotone::output_footer_assets`, [`wp_enqueue_global_styles_custom_css`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_global_styles_custom_css/), [`wp_enqueue_stored_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_stored_styles/), [`wp_add_global_styles_for_blocks`](https://chugunov.pro/api-wordpress/functions/wp_add_global_styles_for_blocks/), [`_wp_theme_json_webfonts_handler`](https://chugunov.pro/api-wordpress/functions/_wp_theme_json_webfonts_handler/), [`wp_enqueue_global_styles_css_custom_properties`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_global_styles_css_custom_properties/), [`wp_enqueue_global_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_global_styles/), [`enqueue_block_styles_assets`](https://chugunov.pro/api-wordpress/functions/enqueue_block_styles_assets/), [`wp_enqueue_registered_block_scripts_and_styles`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_registered_block_scripts_and_styles/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_add_inline_style/
