[wp-trac] [WordPress Trac] #42998: Custom HTML Widget uses widget_text twice in markup

WordPress Trac noreply at wordpress.org
Tue Jan 9 04:59:59 UTC 2018


#42998: Custom HTML Widget uses widget_text twice in markup
-------------------------------------------+------------------------------
 Reporter:  dreamwhisper                   |       Owner:
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Widgets                        |     Version:  4.8.1
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback needs-patch  |     Focuses:
-------------------------------------------+------------------------------

Comment (by alexvorn2):

 I found we can add the 4th parameter "1" in the preg_replace function,
 that will replace only once, so it will look like this:

 {{{
 $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/',
 'widget_text ', $args['before_widget'], 1 );
 }}}

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


More information about the wp-trac mailing list