Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#40772 closed defect (bug) (fixed)

Shortcodes no longer work in text widget after upgrading to 4.8

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

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 10 years ago.
40772.1.diff​ (5.1 KB ) - added by westonruter 10 years ago.
Add unit tests

Download all attachments as: .zip

Change History (7)

#1 @swissspidy
10 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review → 4.8

Good catch @vijustin, thanks!

#2 @jnylen0
10 years ago

Worth adding a test for this?

#3 @westonruter
10 years ago

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

@westonruter
10 years ago

Add unit tests

#4 @westonruter
10 years ago

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

Yes, excellent catch @vijustin.

#5 @westonruter
10 years ago

  • Resolution → fixed
  • Status accepted → 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.