How can I get the privacy policy page?

How can I get the privacy policy page?



After the update regarding the GDPR, WordPress now has an option named "Privacy Policy" under the settings, which you can use a page to be used as your privacy policy page.



How can I get the ID or the permalink for this page to use in my theme or plugin?




2 Answers
2



These functions are available since 4.9.6 for the privacy policy url and link:


get_privacy_policy_url


privacy_policy_url


get_the_privacy_policy_link()


the_privacy_policy_link


the_privacy_policy_link()


get_the_privacy_policy_link()



See ticket #43850



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


options


$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.


$privacy_policy_page



Thanks for contributing an answer to WordPress Development Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)