Skip to content

Instantly share code, notes, and snippets.

@morgyface
Created September 28, 2018 09:24
Show Gist options
  • Select an option

  • Save morgyface/627cb9159e71604b69446fb4e8360448 to your computer and use it in GitHub Desktop.

Select an option

Save morgyface/627cb9159e71604b69446fb4e8360448 to your computer and use it in GitHub Desktop.
WordPress | Privacy page option
<?php
$privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
if ( ! empty( $privacy_policy_page_id ) ) {
$privacy_policy_page_url = get_the_permalink( $privacy_policy_page_id );
?>
<a href="<?php echo $privacy_policy_page_url; ?>">Privacy Policy</a>
<?php } ?>
@morgyface
Copy link
Author

WordPress Privacy Policy page option

You are now able to use an included privacy page or set your own via dashboard > settings > privacy.

To get the ID of the page selected use get_option( 'wp_page_for_privacy_policy' ).

Not much out there in the documentation so I thought this might be of use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment