diff --git a/packages/block-library/src/post-excerpt/edit.js b/packages/block-library/src/post-excerpt/edit.js index 05aaf543b5919..64470d583583a 100644 --- a/packages/block-library/src/post-excerpt/edit.js +++ b/packages/block-library/src/post-excerpt/edit.js @@ -19,6 +19,7 @@ import { import { PanelBody, ToggleControl, RangeControl } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; +import { applyFilters } from '@wordpress/hooks'; /** * Internal dependencies @@ -150,7 +151,8 @@ export default function PostExcerptEditor( { * the raw and the rendered excerpt depending on which is being used. */ const rawOrRenderedExcerpt = ( - rawExcerpt || strippedRenderedExcerpt + applyFilters( 'the_excerpt', undefined, rawExcerpt ) || + strippedRenderedExcerpt ).trim(); let trimmedExcerpt = ''; diff --git a/packages/block-library/src/post-excerpt/index.php b/packages/block-library/src/post-excerpt/index.php index c8882b4062ac0..8cb9a48b8c11b 100644 --- a/packages/block-library/src/post-excerpt/index.php +++ b/packages/block-library/src/post-excerpt/index.php @@ -27,7 +27,8 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) { * wp_trim_words is used instead. */ $excerpt_length = $attributes['excerptLength']; - $excerpt = get_the_excerpt( $block->context['postId'] ); + + $excerpt = apply_filters( 'the_excerpt', get_the_excerpt( $block->context['postId'] ) ); if ( isset( $excerpt_length ) ) { $excerpt = wp_trim_words( $excerpt, $excerpt_length ); }