Make WordPress Core


Ignore:
Timestamp:
09/30/2024 05:17:54 AM (6 weeks ago)
Author:
peterwilsoncc
Message:

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

Removes the automatic addition of rel="noopener noreferrer" from links targeting a new tab or window, target='_blank'. 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.

Deprecates:

  • wp_targeted_link_rel()
  • wp_targeted_link_rel_callback()
  • wp_init_targeted_link_rel_filters(): converted to a noop function
  • wp_remove_targeted_link_rel_filters(): converted to a noop function

The deprecated functions are retained in formatting.php as in SHORTINIT mode the file is included while deprecated.php is not.

This also removes the noopener from links hard coded within the WordPress dashboard linking to documentation and other resources.

Props audrasjb, azaozz, dhruval04, dorzki, neo2k23, presskopp, sabernhardt, swissspidy, tobiasbg.
Fixes #53843.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r59034 r59120  
    14441444                    ),
    14451445                    'description' => array(
    1446                         'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
    1447                         'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
     1446                        'raw'      => '<a href="#" target="_blank">link</a>',
     1447                        'rendered' => '<p><a href="#" target="_blank">link</a></p>',
    14481448                    ),
    14491449                    'caption'     => array(
    1450                         'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
    1451                         'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
     1450                        'raw'      => '<a href="#" target="_blank">link</a>',
     1451                        'rendered' => '<p><a href="#" target="_blank">link</a></p>',
    14521452                    ),
    14531453                ),
Note: See TracChangeset for help on using the changeset viewer.