Widgets: Add `rel="noopener noreferrer"` to links with `target="_blank"` in the Image widget.

Props audrasjb, welcher, afercia.
Fixes #43280.



git-svn-id: https://develop.svn.wordpress.org/trunk@45144 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-04-08 23:22:14 +00:00
parent 5dfdc9b9c4
commit cfebdd3752
2 changed files with 2 additions and 1 deletions

View File

@ -266,7 +266,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
$link .= '>';
$link .= $image;
$link .= '</a>';
$image = $link;
$image = wp_targeted_link_rel( $link );
}
if ( $caption ) {

View File

@ -541,6 +541,7 @@ class Test_WP_Widget_Media_Image extends WP_UnitTestCase {
$this->assertContains( '<a href="https://example.org"', $output );
$this->assertContains( 'target="_blank"', $output );
$this->assertContains( 'rel="noopener noreferrer"', $output );
// Populate caption in attachment.
wp_update_post(