[wp-trac] [WordPress Trac] #40916: Add "noreferrer" to comments in dashboard

WordPress Trac noreply at wordpress.org
Wed Jun 7 16:30:36 UTC 2017


#40916: Add "noreferrer" to comments in dashboard
-------------------------------------------------+-------------------------
 Reporter:  Cybr                                 |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Comments                             |  Review
 Severity:  normal                               |     Version:
 Keywords:  good-first-bug has-patch needs-      |  Resolution:
  testing 2nd-opinion                            |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by Cybr):

 * keywords:  good-first-bug has-patch => good-first-bug has-patch needs-
     testing 2nd-opinion


Comment:

 The file I've attached incorporates @adam3128's changes (author links).
 Also including a filter that applies to all comments' contents on the `wp-
 admin/edit-comments.php` screen.

 The filter catches all links through a new function (`wp_unbind_links()`)
 and removes all formats of `target` and `rel` attributes, finally
 replacing them with empty strings without fail. Even `rel="something
 example'"` gets caught.

 From there it adds `target=_blank rel="noopener noreferrer"` to each found
 link.

 The code has been tested and works on PHP 5.2.16 and PHP 7.1.5.

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


More information about the wp-trac mailing list