has_excerpt( int|WP_Post $post ): bool

Determines whether the post has a custom excerpt.

Description

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

Parameters

$postint|WP_Postoptional
Post ID or WP_Post object. Default is global $post.

Return

bool True if the post has a custom excerpt, false otherwise.

Source

function has_excerpt( $post = 0 ) {
	$post = get_post( $post );
	return ( ! empty( $post->post_excerpt ) );
}

Changelog

VersionDescription
2.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.