钩子文档

stylesheet_directory

💡 云策文档标注

概述

stylesheet_directory 是一个 WordPress 过滤器,用于修改活动主题的样式表目录路径。它允许开发者自定义主题文件的位置,常用于主题开发或插件集成中。

关键要点

  • 这是一个过滤器 Hook,名称为 'stylesheet_directory',用于过滤活动主题的样式表目录路径。
  • 接受三个参数:$stylesheet_dir(活动主题的绝对路径)、$stylesheet(活动主题的目录名)和 $theme_root(主题目录的绝对路径)。
  • 与 get_stylesheet_directory() 函数相关,后者用于检索活动主题的样式表目录路径。
  • 自 WordPress 1.5.0 版本引入,是一个核心功能。

📄 原文内容

Filters the stylesheet directory path for the active theme.

Parameters

$stylesheet_dirstring
Absolute path to the active theme.
$stylesheetstring
Directory name of the active theme.
$theme_rootstring
Absolute path to themes directory.

Source

return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );

Changelog

Version Description
1.5.0 Introduced.