Privacy: Add `rel="privacy-policy"` to the Privacy Policy link.
This changeset adds a `rel="privacy-policy"` attribute to user-facing links to the Privacy Policy of the website, when a privacy policy page is set and available. While this `rel` value is still a RFC of the Link Types HTML specification, this changeset helps to make Privacy Policy link more discoverable for user agents and HTML parsers. Props dshanske, audrasjb, bhavz-10, bookwyrm, faisal03, JeffPaul, peterwilsoncc, paapst, davidbaumwald, costdev, robinwpdeveloper, kawserz. Fixes #56345. Built from https://develop.svn.wordpress.org/trunk@55261 git-svn-id: http://core.svn.wordpress.org/trunk@54794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
11d374ff97
commit
8dc60dd213
|
@ -182,7 +182,17 @@ class Walker_Nav_Menu extends Walker {
|
|||
} else {
|
||||
$atts['rel'] = $menu_item->xfn;
|
||||
}
|
||||
$atts['href'] = ! empty( $menu_item->url ) ? $menu_item->url : '';
|
||||
|
||||
if ( ! empty( $menu_item->url ) ) {
|
||||
if ( get_privacy_policy_url() === $menu_item->url ) {
|
||||
$atts['rel'] = empty( $atts['rel'] ) ? 'privacy-policy' : $atts['rel'] . ' privacy-policy';
|
||||
}
|
||||
|
||||
$atts['href'] = $menu_item->url;
|
||||
} else {
|
||||
$atts['href'] = '';
|
||||
}
|
||||
|
||||
$atts['aria-current'] = $menu_item->current ? 'page' : '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -4664,7 +4664,7 @@ function get_the_privacy_policy_link( $before = '', $after = '' ) {
|
|||
|
||||
if ( $privacy_policy_url && $page_title ) {
|
||||
$link = sprintf(
|
||||
'<a class="privacy-policy-link" href="%s">%s</a>',
|
||||
'<a class="privacy-policy-link" href="%s" rel="privacy-policy">%s</a>',
|
||||
esc_url( $privacy_policy_url ),
|
||||
esc_html( $page_title )
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-55260';
|
||||
$wp_version = '6.2-alpha-55261';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue