[wp-trac] [WordPress Trac] #51042: Post missing excerpt

WordPress Trac noreply at wordpress.org
Tue Aug 18 09:15:23 UTC 2020


#51042: Post missing excerpt
--------------------------+------------------------------
 Reporter:  riaanlom      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Post Formats  |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by Laxman Prajapati):

 @riaanlom
 Ok, I have one minor change.
 Can you please try with below?

 {{{
 $post = get_post(1);
 $excerpt = ! empty( $post->post_content ) ? $post->post_excerpt : null;
 $excerpt = apply_filters( 'get_the_excerpt', $excerpt, $post );
 }}}


 Hope It will works for you.



 Thanks,
 Laxman P


 Replying to [comment:2 riaanlom]:
 > @laxman-prajapati
 >
 > I'm not calling the function directly.
 >
 > This used to return the generate excerpt from the post content but with
 WP 5.5 it returns NULL
 >
 > {{{
 > $post = get_post(1);
 > $excerpt = ! empty( $post->post_excerpt ) ? $post->post_excerpt : null;
 > $excerpt = apply_filters( 'get_the_excerpt', $excerpt, $post );
 > }}}
 >

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


More information about the wp-trac mailing list