diff --git a/src/wp-includes/widgets/class-wp-widget-media-image.php b/src/wp-includes/widgets/class-wp-widget-media-image.php
index 2b9bff2..ef631b2 100644
a
|
b
|
class WP_Widget_Media_Image extends WP_Widget_Media { |
266 | 266 | $link .= '>'; |
267 | 267 | $link .= $image; |
268 | 268 | $link .= '</a>'; |
269 | | $image = $link; |
| 269 | $image = wp_targeted_link_rel( $link ); |
270 | 270 | } |
271 | 271 | |
272 | 272 | if ( $caption ) { |
diff --git a/tests/phpunit/tests/widgets/media-image-widget.php b/tests/phpunit/tests/widgets/media-image-widget.php
index e138f3e..78d55fc 100644
a
|
b
|
class Test_WP_Widget_Media_Image extends WP_UnitTestCase { |
509 | 509 | |
510 | 510 | $this->assertContains( '<a href="https://example.org"', $output ); |
511 | 511 | $this->assertContains( 'target="_blank"', $output ); |
| 512 | $this->assertContains( 'rel="noopener noreferrer"', $output ); |
512 | 513 | |
513 | 514 | // Populate caption in attachment. |
514 | 515 | wp_update_post( |