WordPress is_privacy_policy() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_privacy_policy() returns true when the visitor is on the Privacy Policy page, the page you set in Settings > Privacy. It was added in WordPress 5.2.

Use it to style that page differently, or to avoid showing a cookie banner on the page that explains your cookies.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_privacy_policy() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_privacy_policy()True on the page set as Privacy Policy.
! is_privacy_policy()True on all other pages.
get_privacy_policy_url()Returns the URL of that page.

Set the page in Settings > Privacy.

Full declaration
WordPress
is_privacy_policy(): bool

Parameters

ParameterDescription
NoneThis function takes no parameters.

Return Value

Return ValueDescription
booltrue if the main query is for the Privacy Policy page, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Add a note

Print a line only on the privacy page.

WordPress
<?php if ( is_privacy_policy() ) {
  echo '<p>Last updated: November 2026</p>';
} ?>

How It Works

  1. is_privacy_policy() checks the page chosen in Settings.
  2. The note is printed only there.
  3. Other pages skip it.

Example 2 — Hide the cookie banner

Do not cover the privacy page with a banner.

WordPress
<?php if ( ! is_privacy_policy() ) {
  echo '<div class="cookie-banner">We use cookies.</div>';
} ?>

How It Works

  1. ! is_privacy_policy() means the page is not the privacy page.
  2. The banner is printed on all other pages.
  3. Readers can read the policy without a popup.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
Go to Settings > Privacy and pick a page or create a new one.
is_privacy_policy() returns false on every page.
It was added in WordPress 5.2.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_search()

Check if the current page shows search results.

is_search() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful