Make WordPress Core


Ignore:
Timestamp:
04/08/2019 11:17:35 PM (4 years ago)
Author:
pento
Message:

Widgets: Add rel="noopener noreferrer" to links with target="_blank" in the Text and HTML widgets.

Props audrasjb, birgire, mukesh27.
Fixes #46421.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r44578 r45143  
    328328
    329329        $text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
     330
     331        // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     332        $text = wp_targeted_link_rel( $text );
    330333
    331334        ?>
Note: See TracChangeset for help on using the changeset viewer.