The purpose of wp_trim_excerpt is to create an artificial excerpt if
one doesn't exist for the post. So it applies the content filters to
the content, then trims it down to create the excerpt.If there is an
explicit excerpt on the post, then the content filters will not be
applied to that, nor will the content even get pulled.
So if you're adding something to the beginning of the content, then it
will be in the created excerpt. This is by design.
If you don't want it to do that, use a shortcode to insert your
content. Shortcodes get stripped from auto-created excerpts.
On Tue, Jul 19, 2011 at 5:10 PM, Philip Walton
> So, I've spent some time digging through the source, and it appears the
> wp_trim_excerpt() function applies 'the_content' filters to the excerpt
> default. And it looks like there's no getting around it.
> Can someone please explain the rational behind not differentiating the
> Why should I be forced to apply my content filters to my excerpts as
> On 7/19/11 12:38 PM, Philip Walton wrote:
>> In my theme I'm adding a filter to "the_content" to insert social
>> buttons at the beginning of each post, but then when I call the_excert()
>> text of those buttons is showing up.
>> I know I can just write another filter on "get_the_excerpt" to remove
>> them, but that just seems wrong.
>> Is there a way to filter the_content without affecting the_excerpt?
> wp-hackers mailing list
> [email protected]