[wp-hackers] re-thinking about the way filters work

Michel Fortin michel.fortin at michelf.com
Sun Jun 26 14:59:48 GMT 2005

Le 26 juin 2005, à 1:25, Amit Gupta a écrit :

> frankly, what I fail to understand is why do we need to have the 
> filters of 'the_content' applied to 'the_excerpt'?? I mean what use 
> does it serve??

Some filters (like Markdown) must be processed before the 
`wp_trim_excerpt` function strips HTML tags. Otherwise, some Markdown 
syntax constructs looking like tags get stripped before Markdown has a 
chance to transform them to proper HTML.

That said, other filters need to do their work after trimming. So here 
is what could be done:

Let's say there is a new `get_the_content` filter hook that filter post 
content prior passing it to `the_content`. The `wp_trim_excerpt` 
function could pass the content through `get_the_content` instead of 
`the_content`. Filters could then decide if they must apply before or 
after trimming the excerpt (with `get_the_*` or with `the_*`).

Michel Fortin
michel.fortin at michelf.com

More information about the wp-hackers mailing list