[wp-trac] [WordPress Trac] #4679: the_content() vs. the_excerpt() - apply different filters to posts without excerpt text specified

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 28 08:00:50 GMT 2007


#4679: the_content() vs. the_excerpt() - apply different filters to posts without
excerpt text specified
----------------------------+-----------------------------------------------
 Reporter:  fuggi           |       Owner:  anonymous                        
     Type:  enhancement     |      Status:  new                              
 Priority:  normal          |   Milestone:                                   
Component:  Administration  |     Version:                                   
 Severity:  normal          |    Keywords:  filters, the_content, the_excerpt
----------------------------+-----------------------------------------------
 There is a problem with the way that WP handles the excerpt for posts,
 that do not have a excerpt text specified.

 In this case WP applies the wp_trim_excerpt function via default filter
 which takes the posts content (get_the_content), applies the_content
 filters and then removes HTML etc.

 So this means, that those excerpts will always have the filters for
 the_content applied and there is now way to prevent it from doing that to
 have different filters for the_content and the_excerpt (except from
 writing an excerpt of course).

 It would make more sense if WP would not apply the filters for the_content
 in this case, so that plugin developers have the possibility to apply an
 other filter to the posts when displayed in the excerpt than when
 displayed as post. Plugin designers who want to add their action to both
 content and excerpt (if no own excerpt is written) should have the
 possibility to add a filter to get_the_content instead.

 My plugin WP-Simpleviewer adds a Flash based gallery posts - and when
 these posts are viewed with the_excerpt() they show up with some
 javascript/html looking content, however I would like to show something
 like "Read the whole post to see the gallery".

 So IMHO what has to be done is to add the possibility to add filters to
 get_the_content (according to the codex this does not work yet) and to
 remove the commented line from function wp_trim_excerpt(formatting.php):

 {{{
 $text = get_the_content('');
 //$text = apply_filters('the_content', $text);
 $text = str_replace(']]>', ']]>', $text);
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4679>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list