[wp-trac] [WordPress Trac] #39949: get_the_excerpt() in a widget doesn't work as intended

WordPress Trac noreply at wordpress.org
Thu Feb 23 11:02:25 UTC 2017


#39949: get_the_excerpt() in a widget doesn't work as intended
-------------------------------+------------------------------
 Reporter:  madhatter2099      |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.7.2
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by madhatter2099):

 If I explicitly set an excerpt then it will display properly. It only
 seems to be when there's no excerpt that it doesn't get the correct
 excerpt. Using the apply_filters() function most likely isn't working
 since
 {{{ get_post_field('post_excerpt', $post) }}}
 returns an empty string, which get_the_excerpt() won't know what to do
 with. I found the solution on another site so I'm not confident it's a
 proper solution anyway, I'd rather focus on getting the get_the_excerpt()
 function working.

 I also see no reason that the WP_Post Class couldn't have an excerpt
 method added to it which either returns the excerpt or generates one.

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


More information about the wp-trac mailing list