WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 7 months ago

#40772 closed defect (bug) (fixed)

Shortcodes no longer work in text widget after upgrading to 4.8

Reported by: vijustin Owned by: westonruter
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.8
Component: Widgets Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

The previous method of allowing shortcodes to execute in text widgets via add_filter('widget_text', 'do_shortcode'); no longer works after upgrading to 4.8.

Changing line 98 $text = apply_filters( 'widget_text_content', $widget_text, $instance, $this ); to
$text = apply_filters( 'widget_text_content', $text, $instance, $this ); allows the filters applied via line 82 to pass through.

Attachments (2)

40772.diff (1.0 KB) - added by swissspidy 7 months ago.
40772.1.diff (5.1 KB) - added by westonruter 7 months ago.
Add unit tests

Download all attachments as: .zip

Change History (7)

@swissspidy
7 months ago

#1 @swissspidy
7 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.8

Good catch @vijustin, thanks!

#2 @jnylen0
7 months ago

Worth adding a test for this?

#3 @westonruter
7 months ago

  • Keywords needs-unit-tests added
  • Owner set to westonruter
  • Status changed from new to accepted

@westonruter
7 months ago

Add unit tests

#4 @westonruter
7 months ago

  • Keywords has-unit-tests commit added; needs-unit-tests removed

Yes, excellent catch @vijustin.

#5 @westonruter
7 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 40673:

Widgets: Ensure return value of widget_text filter is not dropped but passed into widget_text_content filter for rendering.

Amends [40631].
Props vijustin, swissspidy, westonruter.
See #35243.
Fixes #40772.

Note: See TracTickets for help on using tickets.