Widgets: Replace adding `balanceTags` on `widget_custom_html_content` filter in favor of just applying `widget_text` filters in Custom HTML widget.

Ensures that users who copy HTML from the Text widget in legacy mode over to the Custom HTML widget will continue to get all of the same filters applied, including tag balancing and shortcodes, if a plugin added support. Plugins still have the `widget_text_content` and `widget_custom_html_content` filters they can use to target the specific widget types.

Merges [41086] onto 4.8 branch.
Amends [40893].
See #40951.
Fixes #40907 for 4.8.1.

Built from https://develop.svn.wordpress.org/branches/4.8@41087


git-svn-id: http://core.svn.wordpress.org/branches/4.8@40927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-07-18 22:19:36 +00:00
parent ec08f02aa4
commit 940c2238ec
3 changed files with 6 additions and 6 deletions

View File

@ -170,8 +170,6 @@ add_filter( 'widget_text_content', 'wptexturize' );
add_filter( 'widget_text_content', 'convert_smilies', 20 );
add_filter( 'widget_text_content', 'wpautop' );
add_filter( 'widget_custom_html_content', 'balanceTags' );
add_filter( 'date_i18n', 'wp_maybe_decline_date' );
// RSS filters

View File

@ -119,7 +119,8 @@ class WP_Widget_Custom_HTML extends WP_Widget {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$content = $instance['content'];
/** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
$content = apply_filters( 'widget_text', $instance['content'], $instance, $this );
/**
* Filters the content of the Custom HTML widget.

View File

@ -213,10 +213,11 @@ class WP_Widget_Text extends WP_Widget {
*
* @since 2.3.0
* @since 4.4.0 Added the `$this` parameter.
* @since 4.8.1 The `$this` param may now be a `WP_Widget_Custom_HTML` object in addition to a `WP_Widget_Text` object.
*
* @param string $text The widget content.
* @param array $instance Array of settings for the current widget.
* @param WP_Widget_Text $this Current Text widget instance.
* @param WP_Widget_Text|WP_Widget_Custom_HTML $this Current Text widget instance.
*/
$text = apply_filters( 'widget_text', $text, $instance, $this );