has_excerpt

The timeline below displays how wordpress function has_excerpt has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.1

/**
 * Determines whether the post has a custom excerpt.
 *
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
 * Conditional Tags} article in the Theme Developer Handbook.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return bool True if the post has a custom excerpt, false otherwise.
 */
function has_excerpt($post = 0)
{
    $post = get_post($post);
    return !empty($post->post_excerpt);
}

WordPress Version: 5.0

/**
 * Determines whether the post has a custom excerpt.
 * 
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 
 * Conditional Tags} article in the Theme Developer Handbook.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return bool True if the post has a custom excerpt, false otherwise.
 */
function has_excerpt($post = 0)
{
    $post = get_post($post);
    return !empty($post->post_excerpt);
}

WordPress Version: 4.8

/**
 * Whether the post has a custom excerpt.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return bool True if the post has a custom excerpt, false otherwise.
 */
function has_excerpt($post = 0)
{
    $post = get_post($post);
    return !empty($post->post_excerpt);
}

WordPress Version: 3.9

/**
 * Whether post has excerpt.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $id Optional. Post ID or post object.
 * @return bool
 */
function has_excerpt($id = 0)
{
    $post = get_post($id);
    return !empty($post->post_excerpt);
}

WordPress Version: 3.7

/**
 * Whether post has excerpt.
 *
 * @since 2.3.0
 *
 * @param int $id Optional. Post ID.
 * @return bool
 */
function has_excerpt($id = 0)
{
    $post = get_post($id);
    return !empty($post->post_excerpt);
}