Make WordPress Core

Ticket #42814: 42814.2.diff

File 42814.2.diff, 1.6 KB (added by spacedmonkey, 6 years ago)
  • src/wp-includes/default-filters.php

     
    170170add_filter( 'the_excerpt', 'convert_chars' );
    171171add_filter( 'the_excerpt', 'wpautop' );
    172172add_filter( 'the_excerpt', 'shortcode_unautop' );
    173 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' );
     173add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 );
    174174
    175175add_filter( 'the_post_thumbnail_caption', 'wptexturize' );
    176176add_filter( 'the_post_thumbnail_caption', 'convert_smilies' );
  • src/wp-includes/formatting.php

     
    36253625 * The ' […]' string can be modified by plugins/themes using the {@see 'excerpt_more'} filter
    36263626 *
    36273627 * @since 1.5.0
     3628 * @since 5.0.0 The `$post` parameter was added.
    36283629 *
    36293630 * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
     3631 * @param int|WP_Post|null $post   Optional. Post ID or post object. Defaults to global $post.
    36303632 * @return string The excerpt.
    36313633 */
    3632 function wp_trim_excerpt( $text = '' ) {
     3634function wp_trim_excerpt( $text = '', $post = null ) {
    36333635        $raw_excerpt = $text;
     3636        $post = get_post( $post );
    36343637        if ( '' == $text ) {
    3635                 $text = get_the_content( '' );
     3638        if ( $post instanceof WP_Post ) {
     3639                $text = $post->post_content;
     3640        }
    36363641
    36373642                $text = strip_shortcodes( $text );
    36383643