Ticket #42814: 42814.2.diff
File 42814.2.diff, 1.6 KB (added by , 6 years ago) |
---|
-
src/wp-includes/default-filters.php
170 170 add_filter( 'the_excerpt', 'convert_chars' ); 171 171 add_filter( 'the_excerpt', 'wpautop' ); 172 172 add_filter( 'the_excerpt', 'shortcode_unautop' ); 173 add_filter( 'get_the_excerpt', 'wp_trim_excerpt' );173 add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 ); 174 174 175 175 add_filter( 'the_post_thumbnail_caption', 'wptexturize' ); 176 176 add_filter( 'the_post_thumbnail_caption', 'convert_smilies' ); -
src/wp-includes/formatting.php
3625 3625 * The ' […]' string can be modified by plugins/themes using the {@see 'excerpt_more'} filter 3626 3626 * 3627 3627 * @since 1.5.0 3628 * @since 5.0.0 The `$post` parameter was added. 3628 3629 * 3629 3630 * @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. 3630 3632 * @return string The excerpt. 3631 3633 */ 3632 function wp_trim_excerpt( $text = '' ) {3634 function wp_trim_excerpt( $text = '', $post = null ) { 3633 3635 $raw_excerpt = $text; 3636 $post = get_post( $post ); 3634 3637 if ( '' == $text ) { 3635 $text = get_the_content( '' ); 3638 if ( $post instanceof WP_Post ) { 3639 $text = $post->post_content; 3640 } 3636 3641 3637 3642 $text = strip_shortcodes( $text ); 3638 3643