is_privacy_policy

函式
is_privacy_policy ( No parameters )
返回值
  • (bool) Whether the query is for the Privacy Policy page.
定義位置
相關方法
get_privacy_policy_urlthe_privacy_policy_linkget_privacy_policy_templateget_the_privacy_policy_linkwp_add_privacy_policy_content
引入
5.2.0
棄用
-

is_privacy_policy – 這個函式檢查當前頁面是否是隱私政策頁面。如果該頁面是隱私政策頁面,則返回true,否則返回false。

確定查詢是否為隱私政策頁。

隱私政策頁是顯示網站隱私政策內容的頁面。

is_privacy_policy()依賴於網站的”改變你的隱私政策頁面”隱私設定’wp_page_for_privacy_policy’。

這個函式只在你設定為”隱私政策頁”的頁面上返回true。

關於這個和類似的主題函式的更多資訊,請檢視《主題開發者手冊》中的{@link Conditional Tags}文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function is_privacy_policy() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_privacy_policy();
}
function is_privacy_policy() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_privacy_policy(); }
function is_privacy_policy() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_privacy_policy();
}

常見問題

FAQs
檢視更多 >