Elementor: noopener for links opening in a new tab

I only needed this on the button element.

To fix it I opened the file:
wp-content/plugins/elementor/includes/widgets/button.php

Change:

1
2
3
4
5
6
if ( $settings['link']['is_external'] ) {
    $this->add_render_attribute( 'button', 'target', '_blank' );
}
if ( $settings['link']['nofollow'] ) {
    $this->add_render_attribute( 'button', 'rel', 'nofollow' );
}

To:

01
02
03
04
05
06
07
08
09
10
11
if ( $settings['link']['is_external'] && $settings['link']['nofollow'] ) {
    $this->add_render_attribute( 'button', 'target', '_blank' );
    $this->add_render_attribute( 'button', 'rel', 'noopener' );
} else {
    if ( $settings['link']['is_external'] ) {
        $this->add_render_attribute( 'button', 'target', '_blank' );
    }
    if ( $settings['link']['nofollow'] ) {
        $this->add_render_attribute( 'button', 'rel', 'nofollow' );
    }
}

wp-content/plugins/elementor/includes/widgets/icon.php

Change:

if ( ! empty( $settings['link']['is_external'] ) ) {
		$this->add_render_attribute( 'icon-wrapper', 'target', '_blank' );
}

if ( $settings['link']['nofollow'] ) {
		$this->add_render_attribute( 'icon-wrapper', 'rel', 'nofollow' );
}

To:

if ( $settings['link']['is_external'] && $settings['link']['nofollow'] ) {
    $this->add_render_attribute( 'icon-wrapper', 'target', '_blank' );
	$this->add_render_attribute( 'icon-wrapper', 'rel', 'noopener' );
} else {
	if ( ! empty( $settings['link']['is_external'] ) ) {
			$this->add_render_attribute( 'icon-wrapper', 'target', '_blank' );
	}

	if ( $settings['link']['nofollow'] ) {
			$this->add_render_attribute( 'icon-wrapper', 'rel', 'nofollow' );
	}
}

wp-content/plugins/elementor/includes/widgets/icon-list.php

Change:

if ( $item['link']['is_external'] ) {
		$this->add_render_attribute( $link_key, 'target', '_blank' );
}

if ( $item['link']['nofollow'] ) {
		$this->add_render_attribute( $link_key, 'rel', 'nofollow' );
}

To:

if ( $item['link']['is_external'] && $item['link']['nofollow'] ) {
    $this->add_render_attribute( $link_key, 'target', '_blank' );
	$this->add_render_attribute( $link_key, 'rel', 'noopener' );
} else {
	if ( $item['link']['is_external'] ) {
			$this->add_render_attribute( $link_key, 'target', '_blank' );
	}

	if ( $item['link']['nofollow'] ) {
			$this->add_render_attribute( $link_key, 'rel', 'nofollow' );
	}
}

Edit: includes/widgets/social-icons.php

if ( $item['link']['is_external'] ) {
		$this->add_render_attribute( $link_key, 'target', '_blank' );
}

if ( $item['link']['nofollow'] ) {
		$this->add_render_attribute( $link_key, 'rel', 'nofollow' );
}

To:

if ( $settings['link']['is_external'] && $settings['link']['nofollow'] ) {
    $this->add_render_attribute( $link_key, 'target', '_blank' );
	$this->add_render_attribute( $link_key, 'rel', 'noopener' );
} else {
	if ( $item['link']['is_external'] ) {
			$this->add_render_attribute( $link_key, 'target', '_blank' );
	}

	if ( $item['link']['nofollow'] ) {
			$this->add_render_attribute( $link_key, 'rel', 'nofollow' );
	}
}

And this:

<pre>
<a class="elementor-icon elementor-social-icon elementor-social-icon-<?php echo $social . $class_animation; ?>" <?php echo $this->get_render_attribute_string( $link_key ); ?>>
</pre>

To:

<pre>
<a rel="noopener" class="elementor-icon elementor-social-icon elementor-social-icon-<?php echo $social . $class_animation; ?>" <?php echo $this->get_render_attribute_string( $link_key ); ?>>
</pre>
wp-content/plugins/ultimate-elementor/modules/buttons/widgets/buttons.php

Change:
if ( $button['link']['is_external'] ) {
		$this->add_render_attribute( 'button_' . $i, 'target', '_blank' );
}

if ( $button['link']['nofollow'] ) {
		$this->add_render_attribute( 'button_' . $i, 'rel', 'nofollow' );
}

To:
if ( $button['link']['is_external'] && $button['link']['nofollow'] ) {
    $this->add_render_attribute( 'button_' . $i, 'target', '_blank' );
	$this->add_render_attribute( 'button_' . $i, 'rel', 'noopener' );
} else {
	if ( $button['link']['is_external'] ) {
			$this->add_render_attribute( 'button_' . $i, 'target', '_blank' );
	}

	if ( $button['link']['nofollow'] ) {
			$this->add_render_attribute( 'button_' . $i, 'rel', 'nofollow' );
	}
}