How can I get the privacy policy page?

WordPress stores the page id for the privacy policy page in the options table. To get the value, you can use:

$privacy_policy_page = get_option( 'wp_page_for_privacy_policy' );

if( $privacy_policy_page ) {
    $permalink = esc_url( get_permalink( $privacy_policy_page ) );
}

The $privacy_policy_page variable holds the ID of the privacy policy page.

Leave a Comment