钩子文档

parent_theme_file_path

💡 云策文档标注

概述

parent_theme_file_path 是一个 WordPress 过滤器钩子,用于修改父主题中文件的路径。它允许开发者在获取父主题文件路径时进行自定义处理。

关键要点

  • 这是一个过滤器钩子,用于过滤父主题文件的路径。
  • 接受两个参数:$path(文件路径)和 $file(请求搜索的文件)。
  • 通过 apply_filters 调用,返回过滤后的路径。
  • 与 get_parent_theme_file_path() 函数相关,用于检索父主题文件路径。
  • 自 WordPress 4.7.0 版本引入。

📄 原文内容

Filters the path to a file in the parent theme.

Parameters

$pathstring
The file path.
$filestring
The requested file to search for.

Source

return apply_filters( 'parent_theme_file_path', $path, $file );

Changelog

Version Description
4.7.0 Introduced.