has_excerpt()

You are here:

has_excerpt( int|WP_Post $post )

Determines whether the post has a custom excerpt.

Description Description

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


Top ↑

Parameters Parameters

$post

(int|WP_Post) (Optional) Post ID or WP_Post object. Default is global $post.


Top ↑

Return Return

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


Top ↑

Source Source

File: wp-includes/post-template.php

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


Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.
Was this article helpful?
Dislike 0
Views: 11