钩子文档

print_styles_array

💡 云策文档标注

概述

print_styles_array 是一个 WordPress 过滤器,用于在样式队列处理输出前修改已入队的样式句柄数组。它允许开发者动态调整样式加载顺序或移除不需要的样式。

关键要点

  • 过滤器名称:print_styles_array
  • 参数:$to_do(数组),包含即将处理的已入队样式句柄列表
  • 应用位置:在 WP_Styles 类中,通过 apply_filters 调用,具体在 $this->to_do 变量上
  • 相关函数:WP_Styles::all_deps() 用于确定样式依赖关系
  • 引入版本:WordPress 2.6.0

📄 原文内容

Filters the array of enqueued styles before processing for output.

Parameters

$to_dostring[]
The list of enqueued style handles about to be processed.

Source

$this->to_do = apply_filters( 'print_styles_array', $this->to_do );

Changelog

Version Description
2.6.0 Introduced.