#51042 closed defect (bug) (fixed)
Post missing excerpt
Reported by: | riaanlom | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.5.1 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Posts, Post Types | Keywords: | commit fixed-major |
Focuses: | Cc: |
Description
If post doesn't have an excerpt, expected outcome is for it to be generated from the post content.
wp-includes/formatting.php
function wp_trim_excerpt line 3811
if ( '' === $text )
Previous versions of WP used == instead of === . The strict comparison operator returns an empty excerpt
Change History (8)
#2
follow-up:
↓ 3
@
4 years ago
@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 );
#3
in reply to:
↑ 2
@
4 years ago
@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 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 );
#4
@
4 years ago
- Milestone changed from Awaiting Review to 5.5.1
- Owner set to SergeyBiryukov
- Status changed from new to accepted
Note: See
TracTickets for help on using
tickets.
@riaanlom
Yes, I agree the == instead of === condition changed on the WordPress version 5.5
But are using like this?: https://developer.wordpress.org/reference/functions/wp_trim_excerpt/
Can you please review this one, May be it will help you.
Thanks,
Laxman P.