[wp-trac] [WordPress Trac] #46421: rel="noopener noreferrer" should be added to links with target="_blank" which are in text and HTML widgets

WordPress Trac noreply at wordpress.org
Tue Mar 19 06:46:11 UTC 2019


#46421: rel="noopener noreferrer" should be added to links with target="_blank"
which are in text and HTML widgets
-----------------------------------+-----------------------
 Reporter:  mark-k                 |       Owner:  audrasjb
     Type:  defect (bug)           |      Status:  accepted
 Priority:  normal                 |   Milestone:  5.2
Component:  Widgets                |     Version:  5.1
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+-----------------------

Comment (by mukesh27):

 @audrasjb,
 [https://core.trac.wordpress.org/attachment/ticket/46421/46421.diff
 46421.diff] patch working fine for me in both the widgets.

 Below HTML code is tested in both the widgets.

 **Code:**

 {{{
 <a href="https://wordpress.org/" target="_blank">WordPress</a>
 <a href="https://wordpress.org/" target="_top">WordPress</a>
 <a href="https://wordpress.org/" target="_self">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noopener">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noreferrer">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noreferrer
 noopener">WordPress</a>
 <a href="https://wordpress.org/" rel="noreferrer noopener">WordPress</a>
 }}}

 **Result:**

 {{{
 <a href="https://wordpress.org/" target="_blank" rel="noopener
 noreferrer">WordPress</a>
 <a href="https://wordpress.org/" target="_top" rel="noopener
 noreferrer">WordPress</a>
 <a href="https://wordpress.org/" target="_self" rel="noopener
 noreferrer">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noopener
 noreferrer">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noreferrer
 noopener">WordPress</a>
 <a href="https://wordpress.org/" target="" rel="noreferrer
 noopener">WordPress</a>
 <a href="https://wordpress.org/" rel="noreferrer noopener">WordPress</a>
 }}}


 Can we change docs for function wp_targeted_link_rel() in both widget?

 {{{
 // Adds rel noreferrer and noopener to all HTML A elements that have a
 target.
 }}}

 something

 {{{
 // Adds rel noreferrer and noopener to all HTML A elements that have a
 target in addition to any existing values.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46421#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list