[wp-trac] [WordPress Trac] #42547: Widgets: Nullify $post global in Custom HTML widget

WordPress Trac noreply at wordpress.org
Tue Nov 14 16:27:24 UTC 2017


#42547: Widgets: Nullify $post global in Custom HTML widget
--------------------------+-------------------------
 Reporter:  westonruter   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.9.1
Component:  Widgets       |    Version:  4.9
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-------------------------
 Handling of shortcodes was added to the Text widget in #10457. When
 shortcodes are processed in the Text widget, the global `$post` is
 nullified so that the shortcodes run in a consistent non-post context,
 since a widget can appear on any template even 404.

 The Custom HTML widget was introduced in 4.8.1 as a replacement for legacy
 use of the Text widget as a place to paste arbitrary HTML. Plugins also
 added shortcode support on the `widget_text` filter, which the Custom HTML
 widget also applies for backwards compatibility. However, the `$post`
 nullification logic from the Text widget was not also implemented in the
 Custom HTML widget, so there's currently a situation where if you try
 using a shortcode in the Custom HTML widget it could get rendered whereas
 it wouldn't in the Text widget.

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


More information about the wp-trac mailing list