函数文档

get_privacy_policy_template()

💡 云策文档标注

概述

get_privacy_policy_template() 函数用于检索当前或父主题中隐私政策页面模板的完整路径。它基于模板层次结构,并可通过动态钩子进行过滤。

关键要点

  • 函数返回隐私政策模板文件的完整路径字符串。
  • 使用 get_query_template() 函数来获取模板,传递 'privacypolicy' 作为模板类型。
  • 支持通过 '$type_template_hierarchy' 和 '$type_template' 动态钩子(其中 $type 为 'privacypolicy')过滤模板层次结构和模板路径。
  • 自 WordPress 5.2.0 版本引入。

代码示例

function get_privacy_policy_template() {
    $templates = array( 'privacy-policy.php' );

    return get_query_template( 'privacypolicy', $templates );
}

📄 原文内容

Retrieves path of Privacy Policy page template in current or parent template.

Description

The template hierarchy and template path are filterable via the ‘$type_template_hierarchy’ and ‘$type_template’ dynamic hooks, where $type is ‘privacypolicy’.

See also

Return

string Full path to privacy policy template file.

Source

function get_privacy_policy_template() {
	$templates = array( 'privacy-policy.php' );

	return get_query_template( 'privacypolicy', $templates );
}

Changelog

Version Description
5.2.0 Introduced.