You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the code, maybe we should just copy the code from WP? We didn't want to do the at first, because we would have to monitor the inner workings of this WP function and sync it when it has changes.
This may be the only code needed, but it should be thoroughly tested, because previous versions of this function broke a bunch of sites.
$post = $this->_post->post_excerpt;
if ( post_password_required( $post ) ) {
return __( 'There is no excerpt because this is a protected post.' );
}
return apply_filters( 'the_excerpt', $post, $post );
// should we also apply get_the_excerpt filter?
@jmslbam The problem with the copy is that when $this->_post->post_excerpt is empty or null, WordPress takes the post_content of the current global $post. This is fine in the while(have_posts()) loop, but does not work for our use case. We want to have the excerpt of a post we specify, instead of the global one (or hope the post_excerpt is not empty).
Research other way to retrieve the excerpt without overruling the global
$post
in Clarkson_Object.php in the functionget_excerpt
.See also https://developer.wordpress.org/reference/functions/get_the_excerpt/#comment-2457
The text was updated successfully, but these errors were encountered: