diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php
index f46f14c177..171243b1b9 100644
--- a/wp-includes/class-walker-nav-menu.php
+++ b/wp-includes/class-walker-nav-menu.php
@@ -169,10 +169,14 @@ class Walker_Nav_Menu extends Walker {
$output .= $indent . '
';
- $atts = array();
- $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
- $atts['target'] = ! empty( $item->target ) ? $item->target : '';
- $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
+ $atts = array();
+ $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
+ $atts['target'] = ! empty( $item->target ) ? $item->target : '';
+ if ( '_blank' === $item->target && empty( $item->xfn ) ) {
+ $atts['rel'] = 'noopener noreferrer';
+ } else {
+ $atts['rel'] = $item->xfn;
+ }
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['aria-current'] = $item->current ? 'page' : '';
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 956342dd54..4628cc9308 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @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.