Widgets: Add `rel="noopener noreferrer"` to links with `target="_blank"` in the Text and HTML widgets.
Props audrasjb, birgire, mukesh27. Fixes #46421. Built from https://develop.svn.wordpress.org/trunk@45143 git-svn-id: http://core.svn.wordpress.org/trunk@44952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f584cc2f67
commit
822e8b1a95
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.2-beta1-45142';
|
||||
$wp_version = '5.2-beta1-45143';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -143,6 +143,9 @@ class WP_Widget_Custom_HTML extends WP_Widget {
|
|||
/** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
|
||||
$content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
|
||||
|
||||
// Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
|
||||
$content = wp_targeted_link_rel( $content );
|
||||
|
||||
/**
|
||||
* Filters the content of the Custom HTML widget.
|
||||
*
|
||||
|
|
|
@ -328,6 +328,9 @@ class WP_Widget_Text extends WP_Widget {
|
|||
|
||||
$text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
|
||||
|
||||
// Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
|
||||
$text = wp_targeted_link_rel( $text );
|
||||
|
||||
?>
|
||||
<div class="textwidget"><?php echo $text; ?></div>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue