{$type}_template_hierarchy

过滤钩子


apply_filters( "{$type}_template_hierarchy", $templates )
参数
  • (string[])
    $templates
    A list of template candidates, in descending order of priority.
    Required:
定义位置
  • wp-includes/template.php
    , line 62
引入
4.7.0
弃用

过滤在检索使用的模板时搜索到的模板文件名的列表。

钩子名称的动态部分,$type,指的是要加载的文件的文件名–减去文件扩展名和任何非字母数字的字符分隔词–。数组中的最后一个元素应该始终是该查询类型的后备模板。

可能的钩子名称包括:

  • 404_template_hierarchy
  • archive_template_hierarchy
  • attachment_template_hierarchy
  • author_template_hierarchy
  • category_template_hierarchy
  • date_template_hierarchy
  • embed_template_hierarchy
  • frontpage_template_hierarchy
  • home_template_hierarchy
  • index_template_hierarchy
  • page_template_hierarchy
  • paged_template_hierarchy
  • privacypolicy_template_hierarchy
  • search_template_hierarchy
  • single_template_hierarchy
  • singular_template_hierarchy
  • tag_template_hierarchy
  • taxonomy_template_hierarchy
$templates = apply_filters( "{$type}_template_hierarchy", $templates );