#42547 closed defect (bug) (fixed)
Widgets: Nullify $post global in Custom HTML widget
Reported by: | westonruter | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Widgets | Keywords: | has-patch commit dev-reviewed |
Focuses: | Cc: |
Description
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.
See patch on #10457, which will resolve this ticket as well.