钩子文档

wp_get_custom_css

💡 云策文档标注

概述

wp_get_custom_css 是一个 WordPress 过滤器,用于修改自定义 CSS 输出到头元素的内容。它允许开发者在渲染自定义 CSS 时进行干预。

关键要点

  • 过滤器名称:wp_get_custom_css
  • 参数:$css(从 Custom CSS 文章类型获取的 CSS 字符串)和 $stylesheet(主题样式表名称)
  • 用途:在 wp_get_custom_css() 函数中应用,用于获取和渲染保存的自定义 CSS 内容
  • 引入版本:WordPress 4.7.0

代码示例

$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );

📄 原文内容

Filters the custom CSS output into the head element.

Parameters

$cssstring
CSS pulled in from the Custom CSS post type.
$stylesheetstring
The theme stylesheet name.

Source

$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );

Changelog

Version Description
4.7.0 Introduced.