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.


Built from https://develop.svn.wordpress.org/trunk@40673


git-svn-id: http://core.svn.wordpress.org/trunk@40536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-05-15 22:36:41 +00:00
parent 66d3a486f6
commit 97e376ca39
2 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-beta1-40672';
$wp_version = '4.8-beta1-40673';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -67,7 +67,7 @@ class WP_Widget_Text extends WP_Widget {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$widget_text = ! empty( $instance['text'] ) ? $instance['text'] : '';
$text = ! empty( $instance['text'] ) ? $instance['text'] : '';
/**
* Filters the content of the Text widget.
@ -75,11 +75,11 @@ class WP_Widget_Text extends WP_Widget {
* @since 2.3.0
* @since 4.4.0 Added the `$this` parameter.
*
* @param string $widget_text The widget content.
* @param array $instance Array of settings for the current widget.
* @param WP_Widget_Text $this Current Text widget instance.
* @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.
*/
$text = apply_filters( 'widget_text', $widget_text, $instance, $this );
$text = apply_filters( 'widget_text', $text, $instance, $this );
if ( isset( $instance['filter'] ) ) {
if ( 'content' === $instance['filter'] ) {
@ -91,11 +91,11 @@ class WP_Widget_Text extends WP_Widget {
*
* @since 4.8.0
*
* @param string $widget_text The widget content.
* @param array $instance Array of settings for the current widget.
* @param WP_Widget_Text $this Current Text widget instance.
* @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.
*/
$text = apply_filters( 'widget_text_content', $widget_text, $instance, $this );
$text = apply_filters( 'widget_text_content', $text, $instance, $this );
} elseif ( $instance['filter'] ) {
$text = wpautop( $text ); // Back-compat for instances prior to 4.8.