функция
since 4.7.0
wp_get_custom_css()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_get_custom_css( string $stylesheet = '' ): string
Описание
Получает сохранённое содержимое произвольного CSS для вывода.
Параметры
$stylesheet
string
необязательный
= ''
Имя таблицы стилей объекта темы. По умолчанию — активная тема.
Возвращаемое значение
string
Исходный код
wp-includes/theme.php:2032
function wp_get_custom_css( $stylesheet = '' ) {
$css = '';
if ( empty( $stylesheet ) ) {
$stylesheet = get_stylesheet();
}
$post = wp_get_custom_css_post( $stylesheet );
if ( $post ) {
$css = $post->post_content;
}
/**
* Filters the custom CSS output into the head element.
*
* @since 4.7.0
*
* @param string $css CSS pulled in from the Custom CSS post type.
* @param string $stylesheet The theme stylesheet name.
*/
$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );
return $css;
}
История изменений
| Версия | Описание |
|---|---|
| 4.7.0 | Introduced. |

