[wp-trac] [WordPress Trac] #40482: apply_filters() for 'get_the_excerpt' doesn't consistently trim the excerpt

WordPress Trac noreply at wordpress.org
Wed Apr 19 13:56:11 UTC 2017


#40482: apply_filters() for 'get_the_excerpt' doesn't consistently trim the excerpt
--------------------------+------------------------------
 Reporter:  AD_Taylor     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.7.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  template
--------------------------+------------------------------

Comment (by dougal):

 This is expected behavior, and working as designed.

 The `wp_trim_excerpt` filter is used when there is no manually set
 excerpt, and WordPress is automagically creating an excerpt based on the
 full post content.

 By passing a long string through the `get_the_excerpt` and `get_excerpt`
 filters, you are simulating the case where you have entered the same long
 text into the `Excerpt` field in the `Edit Post` screen. When a custom
 excerpt is present in the `$post`, no trimming is done (though other
 content filters are applied).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40482#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list