From 79a0cda4d5224df84de75f897a830c71408de9e1 Mon Sep 17 00:00:00 2001 From: Anton Vlasenko Date: Mon, 16 Oct 2023 23:56:01 +0200 Subject: [PATCH] Only add filter before rendering the excerpt to avoid affecting other parts of the codebase where get_the_excerpt() might be used. --- packages/block-library/src/post-excerpt/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/post-excerpt/index.php b/packages/block-library/src/post-excerpt/index.php index ea3220e764ea80..fabd75f98e3672 100644 --- a/packages/block-library/src/post-excerpt/index.php +++ b/packages/block-library/src/post-excerpt/index.php @@ -31,7 +31,7 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) { add_filter( 'excerpt_length', $excerpt_length_filter_callback, PHP_INT_MAX ); // Get the excerpt content for the current block's post. - $excerpt = get_the_excerpt( $block->context['postId'] ); + $excerpt = get_the_excerpt( $block->context['postId'] ); /** * Remove the overridden excerpt length filter to avoid affecting other parts