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:
parent
5dfdc9b9c4
commit
cfebdd3752
@ -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 ) {
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user