Make WordPress Core


Ignore:
Timestamp:
04/08/2019 11:17:35 PM (6 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-custom-html.php

    r43571 r45143  
    143143        /** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
    144144        $content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
     145
     146        // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     147        $content = wp_targeted_link_rel( $content );
    145148
    146149        /**
Note: See TracChangeset for help on using the changeset viewer.