the_privacy_policy_link()WP 4.9.6

Displays the privacy policy link with formatting, when applicable.

1 time — 0.003337 sec (very slow) | 50000 times — 8.74 sec (fast) | PHP 7.0.32, WP 5.1.1

No Hooks.

Return

null. Nothing (null).

Usage

the_privacy_policy_link( $before, $after );
$before(string)
Display before privacy policy link.
Default: ''
$after(string)
Display after privacy policy link.
Default: ''

Examples

0

#1 This will display a link to the privacy policy page.

1-way

<?php the_privacy_policy_link(); ?>

The result, if the page exists:

<a class="privacy-policy-link" href="https://example.com/privacy-policy/">Privacy Policy</a>

2-way

Read the page <?php the_privacy_policy_link(); ?> before commenting. This is important!

The result, if the page exists:

Read the <a class="privacy-policy-link" href="https://example.com/privacy-policy/">Privacy Policy</a> page before commenting. It's important!

If the page is not listed or published:

Read the page before commenting. It's important!

3-way

<?php the_privacy_policy_link( 'Read the page before commenting ', '. It's important!' ); ?>

The result, if the page exists:

Read the <a class="privacy-policy-link" href="https://example.com/privacy-policy/">Privacy Policy</a> page before commenting. It's important!

If the page is not set or published, nothing will be displayed.

0

#2 Sample code for theme integration

With function_exists() test to avoid fatal error on previous WordPress versions.

<?php
if ( function_exists( 'the_privacy_policy_link' ) ) {
	the_privacy_policy_link( '<div class="privacy-policy-link-wrapper">', '</div>' );
}
?>

HTML output example (the permalink and the anchor will be dynamically generated):

<div class="privacy-policy-link-wrapper">
	<a class="privacy-policy-link" href="https://example.com/privacy-policy/">Privacy Policy</a>
</div>

Changelog

Since 4.9.6 Introduced.

the_privacy_policy_link() code WP 6.5.2

function the_privacy_policy_link( $before = '', $after = '' ) {
	echo get_the_privacy_policy_link( $before, $after );
}