get_the_privacy_policy_link()
Returns the privacy policy link with formatting, when applicable.
Uses: get_privacy_policy_url()
Used By: the_privacy_policy_link()
Hooks from the function
Return
String
. Markup for the link and surrounding elements. Empty string if it doesn't exist.
Usage
get_the_privacy_policy_link( $before, $after );
- $before(string)
- Display before privacy policy link.
Default: '' - $after(string)
- Display after privacy policy link.
Default: ''
Examples
#1 This will display a link to the privacy policy page.
1-way
$policy_link = get_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
$policy_link = 'Read the ' . get_the_privacy_policy_link() . ' 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 listed or published:
Read the page before commenting. It's important!
3-way
$policy_link = get_the_privacy_policy_link( 'Read the page before commenting ', '. This is important!' );
The result, if the page exists:
Read the page before commenting <a class="privacy-policy-link" href="https://example.com/privacy-policy/">Privacy Policy</a>. It's important!
If the page is not set or not published, it will return an empty string.
Changelog
Since 4.9.6 | Introduced. |
Since 6.2.0 | Added 'privacy-policy' rel attribute. |