返回
(string) 隐私政策页面的URL。如果不存在,则为空字符串。
源码
更新日志
版本 | 描述 |
---|---|
4.9.6 | 开始引入 |
使用示例
/* Basic example */ /* Get the privacy policy page link*/ // We store the privacy policy link in a variable $privacy_policy_page_link = get_the_privacy_policy_link(); // Our variable will contain something like this // <a class="privacy-policy-link" href="http://www.wpdev.local/politica-privacidad/">Política de privacidad</a> // Now we can work with this link
示例用法
<a href="<?php echo esc_attr( esc_url( get_privacy_policy_url() ) ); ?>"><?php esc_html_e( 'Cookie Policy', 'text-domain' ) ?></a>
// Save privacy page info into separate variables $policy_page_title = ''; $policy_page_url = ''; $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( $policy_page_id && get_post_status( $policy_page_id ) === 'publish' ) { $policy_page_title = get_the_title( $policy_page_id ); $policy_page_url = get_permalink( $policy_page_id ); }
// Example Uses: <?php if($policy_page_id): ?> <a href="<?php echo esc_url(get_permalink($policy_page_id)) ?>" target="_blank"><?php echo esc_html(get_the_title($policy_page_id)); ?></a> <?php endif; ?>