#42547 closed defect (bug) (fixed)
Widgets: Nullify $post global in Custom HTML widget
| Reported by: | westonruter | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.9 |
| Component: | Widgets | Version: | 4.9 |
| Severity: | normal | Keywords: | has-patch commit dev-reviewed |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
See patch on #10457, which will resolve this ticket as well.