WordPress.org

Make WordPress Core

Ticket #10376: 10376.2.diff

File 10376.2.diff, 613 bytes (added by Denis-de-Bernardy, 4 years ago)

untested

  • wp-includes/formatting.php

     
    18161816                $text = strip_tags($text); 
    18171817                $excerpt_length = apply_filters('excerpt_length', 55); 
    18181818                $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); 
    1819                 $words = explode(' ', $text, $excerpt_length + 1); 
     1819                $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); 
    18201820                if (count($words) > $excerpt_length) { 
    18211821                        array_pop($words); 
    18221822                        $text = implode(' ', $words);