diff --git a/src/wp-includes/bookmark-template.php b/src/wp-includes/bookmark-template.php index af48fbfdca..893494a7e9 100644 --- a/src/wp-includes/bookmark-template.php +++ b/src/wp-includes/bookmark-template.php @@ -105,14 +105,6 @@ function _walk_bookmarks( $bookmarks, $args = '' ) { $target = $bookmark->link_target; if ( '' !== $target ) { - if ( is_string( $rel ) && '' !== $rel ) { - if ( ! str_contains( $rel, 'noopener' ) ) { - $rel = trim( $rel ) . ' noopener'; - } - } else { - $rel = 'noopener'; - } - $target = ' target="' . $target . '"'; } diff --git a/tests/phpunit/tests/bookmark/wpListBookmarks.php b/tests/phpunit/tests/bookmark/wpListBookmarks.php deleted file mode 100644 index ba0121fd00..0000000000 --- a/tests/phpunit/tests/bookmark/wpListBookmarks.php +++ /dev/null @@ -1,108 +0,0 @@ -bookmark->create( $args ); - $this->assertStringContainsString( $expected, wp_list_bookmarks( 'echo=0' ) ); - } - - /** - * Data provider. - * - * @return array - */ - public function data_wp_list_bookmarks_adds_noopener() { - return array( - 'target as "_blank"' => array( - 'args' => array( - 'link_name' => 'With _blank', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_blank', - ), - 'expected' => 'rel="noopener"', - ), - 'target as "_blank" and a link relationship' => array( - 'args' => array( - 'link_name' => 'With _blank and a link relationship', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_blank', - 'link_rel' => 'me', - ), - 'expected' => 'rel="me noopener"', - ), - 'target as "_top"' => array( - 'args' => array( - 'link_name' => 'With _top', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_top', - ), - 'expected' => 'rel="noopener"', - ), - 'target as "_top" and a link relationship' => array( - 'args' => array( - 'link_name' => 'With _top and a link relationship', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_top', - 'link_rel' => 'me', - ), - 'expected' => 'rel="me noopener"', - ), - ); - } - - /** - * Test that wp_list_bookmarks does not add "noopener" to the "rel" attribute. - * - * @dataProvider data_wp_list_bookmarks_does_not_add_noopener - * - * @ticket 53839 - * - * @param array $args The arguments to create the bookmark. - */ - public function test_wp_list_bookmarks_does_not_add_noopener( $args ) { - self::factory()->bookmark->create( $args ); - $this->assertStringNotContainsString( 'noopener', wp_list_bookmarks( 'echo=0' ) ); - } - - /** - * Data provider. - * - * @return array - */ - public function data_wp_list_bookmarks_does_not_add_noopener() { - return array( - 'target as "_none"' => array( - 'args' => array( - 'link_name' => 'With _blank', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_none', - ), - ), - 'target as "_none" and a link relationship' => array( - 'args' => array( - 'link_name' => 'With _blank and a link relationship', - 'link_url' => 'https://www.wordpress.org', - 'link_target' => '_none', - 'link_rel' => 'me', - ), - ), - ); - } -}