Open chvillanuevap opened 3 years ago
Hey @chvillanuevap 👋 - As you can see in the source code of get_the_excerpt
here: https://developer.wordpress.org/reference/functions/get_the_excerpt/#source, the filter is applied
return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
Can you test it by adding a filter like the below?
function filter_function_name( $excerpt ) {
return "Filtered -- $excerpt";
}
add_filter( 'get_the_excerpt', 'filter_function_name' );
I saw that, but get_the_excerpt
and the_excerpt
are two different filters. And there are plugins, like Jetpack's Sharing module, that utilize the_excerpt
rather than get_the_excerpt
. I think that for backwards compatibility, the_excerpt
filter should be applied, even if it's a bit redundant.
+1
It looks like we have a clear path to fixing this (applying the the_excerpt filter to the block). It would be good for backwards compatibility and it should not take too long to fix.
What would be the best place to include this in the next sprint/release, @priethor? Thank you!
Added it to the Polish board to mark it as long-hanging fruit (the board name can be confusing, as it also includes this kind of bugfixes)
Description
The post excerpt block does not call the
the_excerpt
filter before rendering the block. In contrast, the post content block does call thethe_content
filter before rendering.Step-by-step reproduction instructions
wp-content/plugins/gutenberg/build/block-library/blocks/post-excerpt.php
wp-content/plugins/gutenberg/build/block-library/blocks/post-content.php
, line 25.Expected behaviour
I would expect that the block that renders the excerpt calls the
the_excerpt
filter.Actual behaviour
The block does not call the
the_excerpt
filter.Code snippet (optional)
In
post-excerpt.php
:In
post-content.php
:WordPress information
Device information