diff --git a/packages/block-library/src/post-excerpt/index.php b/packages/block-library/src/post-excerpt/index.php index c8882b4062ac0..ebd39ad9e1f5f 100644 --- a/packages/block-library/src/post-excerpt/index.php +++ b/packages/block-library/src/post-excerpt/index.php @@ -20,16 +20,33 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) { return ''; } + $post = get_post( $block->context['postId'] ); + /* * The purpose of the excerpt length setting is to limit the length of both * automatically generated and user-created excerpts. * Because the excerpt_length filter only applies to auto generated excerpts, * wp_trim_words is used instead. */ - $excerpt_length = $attributes['excerptLength']; - $excerpt = get_the_excerpt( $block->context['postId'] ); - if ( isset( $excerpt_length ) ) { - $excerpt = wp_trim_words( $excerpt, $excerpt_length ); + if ( ! $post->post_excerpt ) { + $content = $post->post_content; + + // Convert list items to text with proper spacing + $content = preg_replace( '/