[wp-trac] [WordPress Trac] #47244: wp_targeted_link_rel filter should not be applied to 'Custom HTML` widget

WordPress Trac noreply at wordpress.org
Sun May 12 14:07:11 UTC 2019


#47244: wp_targeted_link_rel filter should not be applied to 'Custom HTML` widget
--------------------------+-----------------------------
 Reporter:  fierevere     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  5.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Since WordPress 5.2 is using "Widgets to blocks" there is a breakage for
 user supplied custom HTML code in widgets, notably used for stats and
 counters.

 Example of code:

 {{{
 <!--LiveInternet counter--><script type="text/javascript">
 document.write("<a href='//www.liveinternet.ru/click' "+
 "target=_blank><img src='//counter.yadro.ru/hit?t52.6;r"+
 escape(document.referrer)+((typeof(screen)=="undefined")?"":
 ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
 screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
 ";h"+escape(document.title.substring(0,150))+";"+Math.random()+
 "' alt='' title='LiveInternet: number of pageviews and visitors"+
 " for 24 hours is shown' "+
 "border='0' width='88' height='31'><\/a>")
 </script><!--/LiveInternet-->
 }}}

 the supplied code works for WP prior to 5.2 when used in Custom HTML
 widget, but does not after upgrade to 5.2

 Note from @otto42 (from Slack):

   Okay, the actual problem with that live internet guy’s code is that the
 wp_targeted_link_rel filter function is screwing with his JS code, because
 it sees a targeted link and so it adds the rel noopener code to it.
 Unfortunately, it uses the wrong kind of quote marks

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47244>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list