钩子文档

template_directory_uri

💡 云策文档标注

概述

template_directory_uri 是一个 WordPress 过滤器钩子,用于修改活动主题目录的 URI。它允许开发者在获取主题目录 URI 时进行自定义处理。

关键要点

  • 这是一个过滤器钩子,用于过滤活动主题目录的 URI。
  • 接受三个参数:$template_dir_uri(活动主题目录的 URI)、$template(活动主题的目录名)和 $theme_root_uri(主题根目录的 URI)。
  • 在 get_template_directory_uri() 函数中被调用,用于检索活动主题的模板目录 URI。
  • 自 WordPress 1.5.0 版本引入。

📄 原文内容

Filters the active theme directory URI.

Parameters

$template_dir_uristring
The URI of the active theme directory.
$templatestring
Directory name of the active theme.
$theme_root_uristring
The themes root URI.

Source

return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );

Changelog

Version Description
1.5.0 Introduced.