Make WordPress Core

Changeset 60058


Ignore:
Timestamp:
03/19/2025 11:13:46 PM (12 months ago)
Author:
audrasjb
Message:

General: Remove noopener from links opening in a new tab in wp_list_bookmarks().

This changeset removes the automatic addition of rel="noopener" from links targeting a new tab via target="_blank" in the wp_list_bookmarks() function. Since this was introduced, supported browsers have changed their security policies and no longer allow the opened link to have JavaScript access to the previous tab. This also removes the unit test cases previously located in wpListBookmarks.php as they were dedicated to test the presence of rel="noopener".

Follow-up to [52061], [59120].

Props audrasjb, rvouill, marineevain, jeremy80.
Fixes #63096.

Location:
trunk
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/bookmark-template.php

    r59064 r60058  
    106106        $target = $bookmark->link_target;
    107107        if ( '' !== $target ) {
    108             if ( is_string( $rel ) && '' !== $rel ) {
    109                 if ( ! str_contains( $rel, 'noopener' ) ) {
    110                     $rel = trim( $rel ) . ' noopener';
    111                 }
    112             } else {
    113                 $rel = 'noopener';
    114             }
    115 
    116108            $target = ' target="' . $target . '"';
    117109        }
Note: See TracChangeset for help on using the changeset viewer.