mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Menus: Add rel="noopener"
to target="_blank"
links by default in menus.
This expands upon `rel="noopener"` being previously added to links in the content. Props audrasjb, welcher. Fixes #43290. Built from https://develop.svn.wordpress.org/trunk@45141 git-svn-id: http://core.svn.wordpress.org/trunk@44950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4487551344
commit
a932e9921b
@ -169,10 +169,14 @@ class Walker_Nav_Menu extends Walker {
|
|||||||
|
|
||||||
$output .= $indent . '<li' . $id . $class_names . '>';
|
$output .= $indent . '<li' . $id . $class_names . '>';
|
||||||
|
|
||||||
$atts = array();
|
$atts = array();
|
||||||
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
|
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
|
||||||
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
||||||
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
if ( '_blank' === $item->target && empty( $item->xfn ) ) {
|
||||||
|
$atts['rel'] = 'noopener noreferrer';
|
||||||
|
} else {
|
||||||
|
$atts['rel'] = $item->xfn;
|
||||||
|
}
|
||||||
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
||||||
$atts['aria-current'] = $item->current ? 'page' : '';
|
$atts['aria-current'] = $item->current ? 'page' : '';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.2-beta1-45140';
|
$wp_version = '5.2-beta1-45141';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user