From ab9c9a3c78f93b0e2db4c795835f1279b11a87d3 Mon Sep 17 00:00:00 2001 From: "Thomas A. Reinert" Date: Tue, 4 Jun 2019 12:55:00 +0200 Subject: [PATCH] Fixes #973 --- inc/class-wp-bootstrap-navwalker.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/class-wp-bootstrap-navwalker.php b/inc/class-wp-bootstrap-navwalker.php index 5dd2331..7deeca2 100644 --- a/inc/class-wp-bootstrap-navwalker.php +++ b/inc/class-wp-bootstrap-navwalker.php @@ -183,7 +183,12 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) { } $atts['target'] = ! empty( $item->target ) ? $item->target : ''; - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; + if ( '_blank' === $item->target && empty( $item->xfn ) ) { // Thanks to LukaszJaro, see https://github.com/understrap/understrap/issues/973 + $atts['rel'] = 'noopener noreferrer'; + } else { + $atts['rel'] = $item->xfn; + } + // If item has_children add atts to . if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && $args->depth !== 1 ) { $atts['href'] = '#';