Is there a way for me to check if the user has explicitly set an excerpt? I need to call the excerpt only if they've specified something in the excerpt field, and not an automatically shortened version of the content.
2 Answers
Try this:
if ( has_excerpt( $some_post_id ) ) {
// Do something here?
} else {
// Or here?
}
References:
-
Perfect, thanks. Probably should've checked the conditional tags documentation before posting, haha. I'll accept as soon as it'll let me. Dec 12, 2014 at 17:41
This is an alternative to the answer by @tf
The manual excerpt set by a user is stored as a WP_Post
object, $post_excerpt
.
post_excerpt string User-defined post excerpt
You can access this excerpt inside the loop with $post->post_excerpt
You can simply do a check to see if this object is empty or not