检索隐私策略页面的URL。
原型
get_privacy_policy_url()
返回值
(string)
隐私政策页面的URL。空字符串,如果它不存在。
源文件
路径:wp-includes/link-template.php
<?php
...
function get_privacy_policy_url() {
$url = '';
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) {
$url = (string) get_permalink( $policy_page_id );
}
/**
* Filters the URL of the privacy policy page.
*
* @since 4.9.6
*
* @param string $url The URL to the privacy policy page. Empty string
* if it doesn't exist.
* @param int $policy_page_id The ID of privacy policy page.
*/
return apply_filters( 'privacy_policy_url', $url, $policy_page_id );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_privacy_policy_url/