diff --git a/wp-includes/widgets/class-wp-widget-text.php b/wp-includes/widgets/class-wp-widget-text.php index ad4667bb0f..69b7b91aea 100644 --- a/wp-includes/widgets/class-wp-widget-text.php +++ b/wp-includes/widgets/class-wp-widget-text.php @@ -95,7 +95,7 @@ class WP_Widget_Text extends WP_Widget { } $wpautop = ! empty( $instance['filter'] ); - $has_line_breaks = ( false !== strpos( $instance['text'], "\n" ) ); + $has_line_breaks = ( false !== strpos( trim( $instance['text'] ), "\n" ) ); // If auto-paragraphs are not enabled and there are line breaks, then ensure legacy mode. if ( ! $wpautop && $has_line_breaks ) { @@ -107,15 +107,6 @@ class WP_Widget_Text extends WP_Widget { return true; } - /* - * If a shortcode is present (with support added by a plugin), assume legacy mode - * since shortcodes would apply at the widget_text filter and thus be applied - * before wpautop runs at the widget_text_content filter. - */ - if ( preg_match( '/' . get_shortcode_regex() . '/', $instance['text'] ) ) { - return true; - } - // In the rare case that DOMDocument is not available we cannot reliably sniff content and so we assume legacy. if ( ! class_exists( 'DOMDocument' ) ) { // @codeCoverageIgnoreStart @@ -348,7 +339,7 @@ class WP_Widget_Text extends WP_Widget {

-

+